diff --git a/RemnantSaveGuardian/App.xaml.cs b/RemnantSaveGuardian/App.xaml.cs index d9cfb44..018b2f0 100644 --- a/RemnantSaveGuardian/App.xaml.cs +++ b/RemnantSaveGuardian/App.xaml.cs @@ -11,6 +11,7 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.InteropServices; using System.Threading; using System.Windows; using System.Windows.Markup; @@ -21,10 +22,10 @@ namespace RemnantSaveGuardian { - /// - /// Interaction logic for App.xaml - /// - public partial class App + /// + /// Interaction logic for App.xaml + /// + public partial class App { // The.NET Generic Host provides dependency injection, configuration, logging, and other services. // https://docs.microsoft.com/dotnet/core/extensions/generic-host @@ -85,7 +86,7 @@ public static T GetService() /// private async void OnStartup(object sender, StartupEventArgs e) { - var culture = CultureInfo.CurrentCulture; + var culture = CultureInfo.GetCultureInfo(GetUserDefaultUILanguage()); var cultures = EnumerateSupportedCultures(); Current.Properties["langs"] = cultures; if (!cultures.Contains(culture) && cultures.Contains(culture.Parent)) @@ -106,6 +107,9 @@ private async void OnStartup(object sender, StartupEventArgs e) await _host.StartAsync(); } + [DllImport("Kernel32.dll", CharSet = CharSet.Auto)] + static extern ushort GetUserDefaultUILanguage(); + private CultureInfo[] EnumerateSupportedCultures() { CultureInfo[] culture = CultureInfo.GetCultures(CultureTypes.AllCultures);