summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
index 49c1c488d..d8d16b87a 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs
@@ -284,5 +284,30 @@ namespace HandBrake.ApplicationServices.Utilities
{
return MapLanguages().Values.ToList();
}
+
+ /// <summary>
+ /// The get language code.
+ /// </summary>
+ /// <param name="language">
+ /// The language.
+ /// </param>
+ /// <returns>
+ /// The <see cref="string"/>.
+ /// </returns>
+ public static string GetLanguageCode(string language)
+ {
+ if (string.IsNullOrEmpty(language))
+ {
+ return null;
+ }
+
+ string isoCode;
+ if (MapLanguages().TryGetValue(language, out isoCode))
+ {
+ return isoCode;
+ }
+
+ return null;
+ }
}
}