Skip to content

Commit

Permalink
Fix switching from any language to English
Browse files Browse the repository at this point in the history
  • Loading branch information
julianxhokaxhiu committed Jun 24, 2022
1 parent 5176612 commit 8938566
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
17 changes: 9 additions & 8 deletions SeventhHeavenUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ internal void SetLanguageDictionary(string cultureCode)

switch (cultureCode)
{
case "en":
dict.Source = new Uri("Resources\\StringResources.xaml", UriKind.Relative);
break;
case "fr":
dict.Source = new Uri("Resources\\Languages\\StringResources.fr.xaml", UriKind.Relative);
break;
Expand All @@ -431,19 +434,17 @@ internal void SetLanguageDictionary(string cultureCode)
case "it":
dict.Source = new Uri("Resources\\Languages\\StringResources.it.xaml", UriKind.Relative);
break;
default:
cultureCode = "en";
default:
dict.Source = new Uri("Resources\\StringResources.xaml", UriKind.Relative);
cultureCode = "en";
break;
}
}

if (cultureCode != "en")
{
this.Resources.MergedDictionaries.RemoveAt(1); // remove the default string resources dictionary (second in merged dictionary in App.xaml)
this.Resources.MergedDictionaries.Add(dict);
}

Sys.Settings.AppLanguage = cultureCode;

this.Resources.MergedDictionaries.RemoveAt(1); // remove the default string resources dictionary (second in merged dictionary in App.xaml)
this.Resources.MergedDictionaries.Add(dict);
}

public static string GetAppLanguage()
Expand Down
1 change: 0 additions & 1 deletion SeventhHeavenUI/ViewModels/SetLanguageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ internal bool SaveSelectedLanguageAsDefault()
try
{
Sys.Settings.AppLanguage = LanguagesMap[SelectedLanguage];
ConfigurationManager.RefreshSection("appSettings");

(App.Current as SeventhHeavenUI.App).SetLanguageDictionary(Sys.Settings.AppLanguage);
}
Expand Down

0 comments on commit 8938566

Please sign in to comment.