fix: pallas 无法获取 DynamicResource

This commit is contained in:
uye
2024-04-02 18:14:49 +08:00
parent 3582bd433f
commit 06e9cd8f5f

View File

@@ -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;
}