Skip to content

Commit

Permalink
Added: Default to user's System Language on First Launch
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Mar 9, 2024
1 parent f79d1a2 commit f7d8160
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/Reloaded.Mod.Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,18 @@ private void SetupResources()
var themeSelector = new XamlFileSelector($"{launcherFolder}\\Theme");

var conf = Lib.IoC.GetConstant<LoaderConfig>();
if (conf.FirstLaunch)
{
// Default the language to user's system language.
// e.g. en-GB.xaml
var currentCulture = Thread.CurrentThread.CurrentUICulture + ".xaml";
conf.LanguageFile = languageSelector.Files.FirstOrDefault(x => Path.GetFileName(x) == currentCulture) ?? conf.LanguageFile;
}

themeSelector.SelectXamlFileByName(Path.GetFileName(conf.ThemeFile));
languageSelector.SelectXamlFileByName(Path.GetFileName(conf.LanguageFile));


LibraryBindings.Init(languageSelector, themeSelector);

// Ideally this should be in Setup, however the download dialogs should be localized.
Expand Down

0 comments on commit f7d8160

Please sign in to comment.