diff --git a/System.Application.SteamTools.Client.Desktop.Avalonia.App/System.Application.SteamTools.Client.Desktop.Avalonia.App.csproj b/System.Application.SteamTools.Client.Desktop.Avalonia.App/System.Application.SteamTools.Client.Desktop.Avalonia.App.csproj
index 84785bac3..ea410a722 100644
--- a/System.Application.SteamTools.Client.Desktop.Avalonia.App/System.Application.SteamTools.Client.Desktop.Avalonia.App.csproj
+++ b/System.Application.SteamTools.Client.Desktop.Avalonia.App/System.Application.SteamTools.Client.Desktop.Avalonia.App.csproj
@@ -23,21 +23,21 @@
-
-
-
+
+
+
-
+
-
+
-
+
@@ -53,7 +53,7 @@
Designer
-
+
diff --git a/System.Application.SteamTools.Client.Desktop/UI/Resx/R.cs b/System.Application.SteamTools.Client.Desktop/UI/Resx/R.cs
index 1460111a9..19870ba94 100644
--- a/System.Application.SteamTools.Client.Desktop/UI/Resx/R.cs
+++ b/System.Application.SteamTools.Client.Desktop/UI/Resx/R.cs
@@ -1,7 +1,9 @@
using ReactiveUI;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Globalization;
using System.Linq;
+using System.Reactive.Linq;
namespace System.Application.UI.Resx
{
@@ -14,7 +16,7 @@ namespace System.Application.UI.Resx
public static R Current { get; }
public static readonly IList> Languages;
- public static readonly IList> SteamLanguages;
+ public static readonly Dictionary SteamLanguages;
public static CultureInfo DefaultCurrentUICulture { get; }
@@ -25,9 +27,9 @@ namespace System.Application.UI.Resx
Languages = new Dictionary()
{
{ "", "Auto" },
- { "en", "English" },
{ "zh-Hans", "Chinese(Simplified)" },
{ "zh-Hant", "Chinese(Traditional)" },
+ { "en", "English" },
{ "ko", "Koreana" },
{ "ja", "Japanese" },
{ "ru", "Russian" },
@@ -40,7 +42,7 @@ namespace System.Application.UI.Resx
{ "ko", "koreana" },
{ "ja", "japanese" },
{ "ru", "russian" },
- }.ToList();
+ };
}
static bool IsMatch(CultureInfo cultureInfo, string cultureName)
@@ -68,18 +70,20 @@ namespace System.Application.UI.Resx
void ChangeLanguage()
{
if (IsMatch(CultureInfo.CurrentUICulture, cultureName)) return;
- CultureInfo.CurrentUICulture = new CultureInfo(cultureName);
- AppResources.Culture = CultureInfo.CurrentUICulture;
+ CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo(cultureName);
+ AppResources.Culture = CultureInfo.GetCultureInfo(cultureName);
+ Current.Res = new AppResources();
Current.RaisePropertyChanged(nameof(Res));
}
MainThreadDesktop.BeginInvokeOnMainThread(ChangeLanguage);
}
- R()
+ public string GetCurrentCultureSteamLanguageName()
{
- Res = new AppResources();
+ return AppResources.Culture == null ? Languages.First().Value : SteamLanguages[AppResources.Culture.Name];
}
- public AppResources Res { get; }
+ //public AppResources Res => new AppResources();
+ public AppResources Res { get; set; } = new AppResources();
}
}
\ No newline at end of file