From e193afdd997a5a2bc751ee6d64be3a5d4e9b74cc Mon Sep 17 00:00:00 2001 From: MistEO Date: Wed, 7 Sep 2022 23:41:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=8C=96=E7=BF=BB=E8=AF=91=E7=9A=84=E8=AF=BB=E5=8F=96=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAsstGui/Helper/Localization.cs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/MeoAsstGui/Helper/Localization.cs b/src/MeoAsstGui/Helper/Localization.cs index c68c2f4f4c..2b84172c4b 100644 --- a/src/MeoAsstGui/Helper/Localization.cs +++ b/src/MeoAsstGui/Helper/Localization.cs @@ -15,6 +15,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Windows; +using System.Windows.Input; namespace MeoAsstGui { @@ -92,18 +93,20 @@ namespace MeoAsstGui culture = Localization.culture; } - var dictionary = new ResourceDictionary + var culureList = new string[] { culture, "en-us", "zh-cn", }; + foreach (var curCulutre in culureList) { - Source = new Uri($@"Resources\Localizations\{culture}.xaml", UriKind.Relative), - }; - if (dictionary.Contains(key)) - { - return dictionary[key] as string; - } - else - { - return $"{{{{ {key} }}}}"; + var dictionary = new ResourceDictionary + { + Source = new Uri($@"Resources\Localizations\{curCulutre}.xaml", UriKind.Relative), + }; + if (dictionary.Contains(key)) + { + return dictionary[key] as string; + } } + + return $"{{{{ {key} }}}}"; } } }