From 06e9cd8f5f558f9af981114aef6e4c201da2019e Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Tue, 2 Apr 2024 18:14:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20pallas=20=E6=97=A0=E6=B3=95=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=20DynamicResource?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Helper/LocalizationHelper.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/MaaWpfGui/Helper/LocalizationHelper.cs b/src/MaaWpfGui/Helper/LocalizationHelper.cs index 5aafc1b258..e627dc2d2b 100644 --- a/src/MaaWpfGui/Helper/LocalizationHelper.cs +++ b/src/MaaWpfGui/Helper/LocalizationHelper.cs @@ -55,9 +55,9 @@ namespace MaaWpfGui.Helper } foreach (var lang in from lang in SupportedLanguages - let key = lang.Key.Contains('-') ? lang.Key.Split('-')[0] : lang.Key - where local.StartsWith(key) || key.StartsWith(local) - select lang) + let key = lang.Key.Contains('-') ? lang.Key.Split('-')[0] : lang.Key + where local.StartsWith(key) || key.StartsWith(local) + select lang) { return lang.Key; } @@ -75,6 +75,16 @@ namespace MaaWpfGui.Helper { if (_culture == "pallas") { + var dictionary = new ResourceDictionary + { + Source = new Uri($@"Res\Localizations\zh-cn.xaml", UriKind.Relative), + }; + foreach (var key in dictionary.Keys) + { + dictionary[key] = GetPallasString(); + } + + Application.Current.Resources.MergedDictionaries.Add(dictionary); return; }