diff options
author | sr55 <[email protected]> | 2017-01-24 19:12:46 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2017-01-24 19:13:28 +0000 |
commit | 928e01c5dee1e989fb5986ed1a7d12fcb869b6b4 (patch) | |
tree | 7f13dd405df7833782b24897c6c8034fa8f4ea88 /win | |
parent | e35254ee7f29d463dd5e32f8b2ca6772a4d59991 (diff) |
WinGui: Always use iso639 for srt language code rather than name. #541
Diffstat (limited to 'win')
3 files changed, 48 insertions, 2 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;
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs index 3a2a8057c..30aa9906d 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs @@ -239,7 +239,7 @@ namespace HandBrakeWPF.Services.Encode.Factories { Filename = item.SrtPath, Codeset = item.SrtCharCode, - Language = item.SrtLang + Language = item.SrtLangCode } }; diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs index b4cb45d61..b19fc80f4 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs @@ -11,6 +11,8 @@ namespace HandBrakeWPF.Services.Encode.Model.Models { using System; + using HandBrake.ApplicationServices.Utilities; + using HandBrakeWPF.Services.Scan.Model; using HandBrakeWPF.Utilities; @@ -46,6 +48,8 @@ namespace HandBrakeWPF.Services.Encode.Model.Models /// </summary> private bool forced; + private string srtLang; + #endregion #region Constructors and Destructors @@ -198,7 +202,24 @@ namespace HandBrakeWPF.Services.Encode.Model.Models /// <summary> /// Gets or sets the SRT Language /// </summary> - public string SrtLang { get; set; } + public string SrtLang + { + get + { + return this.srtLang; + } + set + { + this.srtLang = value; + string iso639 = LanguageUtilities.GetLanguageCode(this.srtLang); + this.SrtLangCode = iso639; + } + } + + /// <summary> + /// Gets or sets the srt lang code. + /// </summary> + public string SrtLangCode { get; set; } /// <summary> /// Gets or sets the SRT Offset |