summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-01-24 19:12:46 +0000
committersr55 <[email protected]>2017-01-24 19:12:46 +0000
commitc32a823816c58ffc8ea72394f40629f769830c09 (patch)
tree684f60806781ad718c4f98b40357d73d7d9d39e3
parentca1dcccd09b5dfac93829d46fd6c7c9711898b77 (diff)
WinGui: Always use iso639 for srt language code rather than name. #541
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs25
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs23
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