summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-05-29 17:31:58 +0000
committersr55 <[email protected]>2013-05-29 17:31:58 +0000
commitbffc8a4ab97bcd4630496c62be4720e0c590f1fa (patch)
treede2a7bac1438c0dbec660388fee636053ef3a96b /win/CS/HandBrakeWPF
parente0c83de39ee1c7533842c566b4cbea80c0257f99 (diff)
WinGui: Use ISO639-2 Codes rather than language names for auto language selection
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5524 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs13
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs13
2 files changed, 18 insertions, 8 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
index 2146b1c6c..ee9b09f31 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
@@ -38,6 +38,9 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
private IEnumerable<Audio> sourceTracks;
+ /// <summary>
+ /// The current preset.
+ /// </summary>
private Preset currentPreset;
#region Constructors and Destructors
@@ -414,9 +417,15 @@ namespace HandBrakeWPF.ViewModels
private IEnumerable<Audio> GetSelectedLanguagesTracks()
{
List<Audio> trackList = new List<Audio>();
- foreach (string language in this.UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages))
+
+
+ List<string> isoCodes =
+ LanguageUtilities.GetLanguageCodes(
+ this.UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages));
+
+ foreach (string code in isoCodes)
{
- trackList.AddRange(this.SourceTracks.Where(source => source.Language.Trim() == language));
+ trackList.AddRange(this.SourceTracks.Where(source => source.LanguageCode.Trim() == code));
}
return trackList;
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
index 90dae495f..feabc08f3 100644
--- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
@@ -113,7 +113,6 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public void AddAllClosedCaptions()
{
-
foreach (Subtitle subtitle in this.SourceTitlesSubset(null).Where(s => s.SubtitleType == SubtitleType.CC))
{
this.Add(subtitle);
@@ -137,12 +136,14 @@ namespace HandBrakeWPF.ViewModels
public void AddAllRemainingForSelectedLanguages()
{
// Get a list of subtitle tracks that match the users lanaguages
- StringCollection userSelectedLanguages =
- this.UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages);
- userSelectedLanguages.Add(
- this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles));
+ StringCollection userSelectedLanguages = this.UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages);
+ userSelectedLanguages.Add(this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles));
+
+ // Translate to Iso Codes
+ List<string> iso6392Codes = LanguageUtilities.GetLanguageCodes(userSelectedLanguages);
+
List<Subtitle> availableTracks =
- this.SourceTracks.Where(subtitle => userSelectedLanguages.Contains(subtitle.Language)).ToList();
+ this.SourceTracks.Where(subtitle => iso6392Codes.Contains(subtitle.LanguageCodeClean)).ToList();
foreach (Subtitle subtitle in this.SourceTitlesSubset(availableTracks))
{