From fe673959a5ade8eb99c3e647be60ff8529feef1b Mon Sep 17 00:00:00 2001 From: Aigio Liu Date: Mon, 16 May 2022 19:54:18 +0800 Subject: [PATCH] Add About_FormerName --- README.en.md | 2 +- README.md | 2 +- .../Extensions/CultureInfoExtensions.cs | 16 ++++----- .../Properties/InternalsVisibleTo.cs | 2 +- src/FDELauncher/Compat/CultureInfo2.cs | 21 ------------ .../Compat/CultureInfoExtensions.cs | 21 ++++++++++++ src/FDELauncher/Properties/Resources.cs | 14 ++++---- .../UI/Controllers/AboutController.cs | 10 ++++-- .../UI/Resx/AppResources.Designer.cs | 9 +++++ src/ST.Client/UI/Resx/AppResources.en.resx | 34 +++++++++++-------- src/ST.Client/UI/Resx/AppResources.resx | 3 ++ src/ST.Client/UI/Resx/R.cs | 24 +++---------- .../Pages/About/AboutPageViewModel.Mobile.cs | 1 + 13 files changed, 83 insertions(+), 76 deletions(-) delete mode 100644 src/FDELauncher/Compat/CultureInfo2.cs create mode 100644 src/FDELauncher/Compat/CultureInfoExtensions.cs diff --git a/README.en.md b/README.en.md index a5bb0b788b7..6520786fcd4 100644 --- a/README.en.md +++ b/README.en.md @@ -1,4 +1,4 @@ -

Watt Toolkit 🧰

+

Watt Toolkit 🧰 (Former name Steam++)

diff --git a/README.md b/README.md index e6113048438..6e568a4594a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

Watt Toolkit 🧰

+

Watt Toolkit 🧰 (原名 Steam++)

diff --git a/src/Common.CoreLib/Extensions/CultureInfoExtensions.cs b/src/Common.CoreLib/Extensions/CultureInfoExtensions.cs index d9562090ab2..97448b5c0f1 100644 --- a/src/Common.CoreLib/Extensions/CultureInfoExtensions.cs +++ b/src/Common.CoreLib/Extensions/CultureInfoExtensions.cs @@ -5,41 +5,41 @@ namespace System { public static class CultureInfoExtensions { - public static bool IsMatch(CultureInfo cultureInfo, string cultureName) + public static bool IsMatch(this CultureInfo cultureInfo, string cultureName) { if (string.IsNullOrWhiteSpace(cultureInfo.Name)) { return false; } - if (cultureInfo.Name == cultureName) + if (string.Equals(cultureInfo.Name, cultureName, StringComparison.OrdinalIgnoreCase)) { return true; } else { - return IsMatch(cultureInfo.Parent, cultureName); + return cultureInfo.Parent.IsMatch(cultureName); } } public static string GetAcceptLanguage(this CultureInfo culture) { - if (IsMatch(culture, "zh-Hans")) + if (culture.IsMatch("zh-Hans")) { return "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"; } - else if (IsMatch(culture, "zh-Hant")) + else if (culture.IsMatch("zh-Hant")) { return "zh-HK,zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7"; } - else if (IsMatch(culture, "ko")) + else if (culture.IsMatch("ko")) { return "ko;q=0.9,en-US;q=0.8,en;q=0.7"; } - else if (IsMatch(culture, "ja")) + else if (culture.IsMatch("ja")) { return "ja;q=0.9,en-US;q=0.8,en;q=0.7"; } - else if (IsMatch(culture, "ru")) + else if (culture.IsMatch("ru")) { return "ru;q=0.9,en-US;q=0.8,en;q=0.7"; } diff --git a/src/Common.CoreLib/Properties/InternalsVisibleTo.cs b/src/Common.CoreLib/Properties/InternalsVisibleTo.cs index 99bf932b438..39c6098fa75 100644 --- a/src/Common.CoreLib/Properties/InternalsVisibleTo.cs +++ b/src/Common.CoreLib/Properties/InternalsVisibleTo.cs @@ -7,4 +7,4 @@ [assembly: InternalsVisibleTo("System.Application.SteamTools.Client.UnitTest" + PublicKey)] [assembly: InternalsVisibleTo("System.Application.SteamTools.Client.Desktop.UnitTest" + PublicKey)] [assembly: InternalsVisibleTo("System.Application.SteamTools.Client.Droid.UnitTest" + PublicKey)] -[assembly: InternalsVisibleTo("System.Application.SteamTools.Client.Droid.UnitTest.App" + PublicKey)] \ No newline at end of file +[assembly: InternalsVisibleTo("System.Application.SteamTools.Client.Droid.UnitTest.App" + PublicKey)] \ No newline at end of file diff --git a/src/FDELauncher/Compat/CultureInfo2.cs b/src/FDELauncher/Compat/CultureInfo2.cs deleted file mode 100644 index 25fbe2aaf15..00000000000 --- a/src/FDELauncher/Compat/CultureInfo2.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace System.Globalization -{ - public static class CultureInfo2 - { - public static bool IsMatch(CultureInfo cultureInfo, string cultureName) - { - if (String2.IsNullOrWhiteSpace(cultureInfo.Name)) - { - return false; - } - if (cultureInfo.Name == cultureName) - { - return true; - } - else - { - return IsMatch(cultureInfo.Parent, cultureName); - } - } - } -} diff --git a/src/FDELauncher/Compat/CultureInfoExtensions.cs b/src/FDELauncher/Compat/CultureInfoExtensions.cs new file mode 100644 index 00000000000..12691948d40 --- /dev/null +++ b/src/FDELauncher/Compat/CultureInfoExtensions.cs @@ -0,0 +1,21 @@ +namespace System.Globalization +{ + public static class CultureInfoExtensions + { + public static bool IsMatch(this CultureInfo cultureInfo, string cultureName) + { + if (String2.IsNullOrWhiteSpace(cultureInfo.Name)) + { + return false; + } + if (string.Equals(cultureInfo.Name, cultureName, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + else + { + return cultureInfo.Parent.IsMatch(cultureName); + } + } + } +} diff --git a/src/FDELauncher/Properties/Resources.cs b/src/FDELauncher/Properties/Resources.cs index caaa3dd0773..213307762f0 100644 --- a/src/FDELauncher/Properties/Resources.cs +++ b/src/FDELauncher/Properties/Resources.cs @@ -22,19 +22,19 @@ public static CultureInfo Culture public static string GetString(Func getString, CultureInfo? resourceCulture = null) { resourceCulture ??= Culture; - if (CultureInfo2.IsMatch(resourceCulture, "zh-Hans")) + if (resourceCulture.IsMatch("zh-Hans")) return getString(Language.ChineseSimplified); - else if (CultureInfo2.IsMatch(resourceCulture, "zh-Hant")) + else if (resourceCulture.IsMatch("zh-Hant")) return getString(Language.ChineseTraditional); - else if (CultureInfo2.IsMatch(resourceCulture, "es")) + else if (resourceCulture.IsMatch("es")) return getString(Language.Spanish); - else if (CultureInfo2.IsMatch(resourceCulture, "it")) + else if (resourceCulture.IsMatch("it")) return getString(Language.Italian); - else if (CultureInfo2.IsMatch(resourceCulture, "ja")) + else if (resourceCulture.IsMatch("ja")) return getString(Language.Japanese); - else if (CultureInfo2.IsMatch(resourceCulture, "ko")) + else if (resourceCulture.IsMatch("ko")) return getString(Language.Korean); - else if (CultureInfo2.IsMatch(resourceCulture, "ru")) + else if (resourceCulture.IsMatch("ru")) return getString(Language.Russian); else return getString(Language.English); diff --git a/src/ST.Client.Android/UI/Controllers/AboutController.cs b/src/ST.Client.Android/UI/Controllers/AboutController.cs index fb9af038105..b2b09cb43d7 100644 --- a/src/ST.Client.Android/UI/Controllers/AboutController.cs +++ b/src/ST.Client.Android/UI/Controllers/AboutController.cs @@ -147,7 +147,7 @@ public override bool OnClick(View view) { lang = "zh-cn"; } - else if (R.Culture.Name.StartsWith("ja", StringComparison.OrdinalIgnoreCase)) + else if (R.Culture.IsMatch("ja")) { lang = "ja-jp"; } @@ -166,12 +166,18 @@ public override bool OnClick(View view) static SpannableString CreateTitle() { - SpannableString spannable = new(Title_0 + Title_1); + const string title_const = Title_0 + Title_1 + Title_2_; + var title = string.Format(title_const, AppResources.About_FormerName); + SpannableString spannable = new(title); ForegroundColorSpan fcs = new(ThemeAccentBrushKey.ToPlatformColor()); int start = Title_0.Length, end = Title_0.Length + Title_1.Length; spannable.SetSpan(fcs, start, end, SpanTypes.ExclusiveExclusive); StyleSpan ss = new(TypefaceStyle.Bold); spannable.SetSpan(ss, start, end, SpanTypes.ExclusiveExclusive); + start = end; + end = title.Length; + AbsoluteSizeSpan ass = new(14, true); + spannable.SetSpan(ass, start, end, SpanTypes.ExclusiveExclusive); return spannable; } diff --git a/src/ST.Client/UI/Resx/AppResources.Designer.cs b/src/ST.Client/UI/Resx/AppResources.Designer.cs index 234a3e898a7..3a66bfadb66 100644 --- a/src/ST.Client/UI/Resx/AppResources.Designer.cs +++ b/src/ST.Client/UI/Resx/AppResources.Designer.cs @@ -171,6 +171,15 @@ public static string About_FAQ { } } + /// + /// 查找类似 原名 的本地化字符串。 + /// + public static string About_FormerName { + get { + return ResourceManager.GetString("About_FormerName", resourceCulture); + } + } + /// /// 查找类似 加入我们 的本地化字符串。 /// diff --git a/src/ST.Client/UI/Resx/AppResources.en.resx b/src/ST.Client/UI/Resx/AppResources.en.resx index afe5722be32..f4b58f70b21 100644 --- a/src/ST.Client/UI/Resx/AppResources.en.resx +++ b/src/ST.Client/UI/Resx/AppResources.en.resx @@ -370,7 +370,7 @@ Comment=;Author=deepl - Route your traffic by setting up a Windows system proxy. It does not require a free port 443, yet it will affect all local network traffic. If hosts routing mode works, you won't be needing this mode. + Route your traffic by setting up a Windows system proxy. It does not require a free port 443, yet it will affect all local network traffic. If hosts routing mode works, you won't be needing this mode. Comment=;Author=沙中金 @@ -430,7 +430,7 @@ Comment=;Author=沙中金 - Your account information will be permanently deleted and you cannot log in again using this account's credentials. Ready to deactivate your account? + Your account information will be permanently deleted and you cannot log in again using this account's credentials. Ready to deactivate your account? Comment=;Author=沙中金 @@ -730,7 +730,7 @@ Comment=;Author=沙中金 - *Game running as a desktop wallpaper may be incontrollable and irresponsive to inputs. This bug can be fixed but it has not yet become the primary focus of this software. Hence, this bug may persist in several future updates. The wallpaper will freeze at the last remaining frame of the game after it stops running. A single click on 'Refresh wallpaper' button may reset the wallpaper to default. This feature conflicts with other live wallpaper softwares such as Wallpaper Engine. Quit other softwares like Wallpaper Engine before using this feature. + *Game running as a desktop wallpaper may be incontrollable and irresponsive to inputs. This bug can be fixed but it has not yet become the primary focus of this software. Hence, this bug may persist in several future updates. The wallpaper will freeze at the last remaining frame of the game after it stops running. A single click on 'Refresh wallpaper' button may reset the wallpaper to default. This feature conflicts with other live wallpaper softwares such as Wallpaper Engine. Quit other softwares like Wallpaper Engine before using this feature. Comment=;Author=沙中金 @@ -858,7 +858,7 @@ Comment=同意 or 取消;Author=沙中金 - You don't have permission to view confirmation messages. Check if you have enabled 'community-generated content' in Family View. + You don't have permission to view confirmation messages. Check if you have enabled 'community-generated content' in Family View. Comment=;Author=沙中金 @@ -994,7 +994,7 @@ Comment=;Author=沙中金 - In addition, you can use Windows built-in account encryption to protect your data. This locks your Authenticators to the current user on this computer, so even if they're duplicated, they will remain inaccessible. You must turn this feature off if you want to reformat your disk, reinstall Windows or delete this user account. + In addition, you can use Windows built-in account encryption to protect your data. This locks your Authenticators to the current user on this computer, so even if they're duplicated, they will remain inaccessible. You must turn this feature off if you want to reformat your disk, reinstall Windows or delete this user account. Comment=;Author=沙中金 @@ -1042,7 +1042,7 @@ Comment=;Author=沙中金 - A desktop implementation of Steam Authenticator. Please import from file named 'maFile' in 'maFiles' folders under SDA path. (Encrypted files not supported. Remove password before continuing) + A desktop implementation of Steam Authenticator. Please import from file named 'maFile' in 'maFiles' folders under SDA path. (Encrypted files not supported. Remove password before continuing) Comment=;Author=沙中金 @@ -1078,7 +1078,7 @@ Comment=;Author=沙中金 - In the 'files' folder, open the 'SteamGuard-NNNNNNNNN' file and paste the entire contents of the file + In the 'files' folder, open the 'SteamGuard-NNNNNNNNN' file and paste the entire contents of the file Comment=;Author=沙中金 @@ -1114,7 +1114,7 @@ Comment=;Author=沙中金 - In 'shared_prefs' folder, paste uuidKey from 'steam_uuid.xml' + In 'shared_prefs' folder, paste uuidKey from 'steam_uuid.xml' Comment=;Author=沙中金 @@ -1126,7 +1126,7 @@ Comment=;Author=沙中金 - WinAuth is Windows' portable open source authenticator, which provides counter-based or time-based RFC 6238 authenticators and common implementations. Import method: After exporting the txt file from WinAuth, select it here for importing. + WinAuth is Windows' portable open source authenticator, which provides counter-based or time-based RFC 6238 authenticators and common implementations. Import method: After exporting the txt file from WinAuth, select it here for importing. Comment=;Author=沙中金 @@ -1170,7 +1170,7 @@ Comment=;Author=沙中金 - It's mine + It's mine Comment=;Author=MicrosoftTranslator @@ -2437,7 +2437,7 @@ Are you really sure? Error code: {0} -An error occurred while retrieving achievement statistics, either because the game doesn't have achievements, or you don't have the game. +An error occurred while retrieving achievement statistics, either because the game doesn't have achievements, or you don't have the game. Comment=;Author=MicrosoftTranslator @@ -2467,7 +2467,7 @@ This action ends with a running Steam jump to the new account login window.Comment=;Author=AigioL - The release of the current version of Watt Toolkit can't be separated from everyone's support, and if Watt Toolkit is helpful to you, and you want us to keep new features developed and maintained for a long time, you may consider giving us a little contribution to make our more dynamic update maintenance Watt Toolkit. + The release of the current version of Watt Toolkit can't be separated from everyone's support, and if Watt Toolkit is helpful to you, and you want us to keep new features developed and maintained for a long time, you may consider giving us a little contribution to make our more dynamic update maintenance Watt Toolkit. *Please remember to have the UID of your Watt Toolkit account in the notes message when making a donation, so that we can feed the donation reward back to your account later. Comment=;Author=AigioL @@ -2496,7 +2496,7 @@ This action ends with a running Steam jump to the new account login window.Comment=;Author=MicrosoftTranslator - Can't display image verification codes? + Can't display image verification codes? Comment=;Author=MicrosoftTranslator @@ -2833,7 +2833,7 @@ The system will {1} after {0} seconds. Comment=;Author=MicrosoftTranslator - Check out more of this author's work + Check out more of this author's work Comment=;Author=MicrosoftTranslator @@ -2944,4 +2944,8 @@ The system will {1} after {0} seconds. Vertical cover Comment=;Author=MicrosoftTranslator - + + Former name + Comment=;Author=AigioL + + \ No newline at end of file diff --git a/src/ST.Client/UI/Resx/AppResources.resx b/src/ST.Client/UI/Resx/AppResources.resx index addfd7b3ee1..7936137713f 100644 --- a/src/ST.Client/UI/Resx/AppResources.resx +++ b/src/ST.Client/UI/Resx/AppResources.resx @@ -2260,4 +2260,7 @@ AAAAA-BBBBB-CCCC3 证书状态 + + 原名 + \ No newline at end of file diff --git a/src/ST.Client/UI/Resx/R.cs b/src/ST.Client/UI/Resx/R.cs index 6e098d09a39..1b3f776f885 100644 --- a/src/ST.Client/UI/Resx/R.cs +++ b/src/ST.Client/UI/Resx/R.cs @@ -43,7 +43,7 @@ public R() public static CultureInfo DefaultCurrentUICulture { get; private set; } - public static bool IsChineseSimplified => IsMatch(Culture, zh_Hans); + public static bool IsChineseSimplified => Culture.IsMatch(zh_Hans); const string zh_Hans = "zh-Hans"; @@ -78,22 +78,6 @@ static R() AppResources.Culture = DefaultCurrentUICulture; } - static bool IsMatch(CultureInfo cultureInfo, string cultureName) - { - if (string.IsNullOrWhiteSpace(cultureInfo.Name)) - { - return false; - } - if (cultureInfo.Name == cultureName) - { - return true; - } - else - { - return IsMatch(cultureInfo.Parent, cultureName); - } - } - public static void ChangeAutoLanguage(CultureInfo? cultureInfo = null) => MainThread2.BeginInvokeOnMainThread(() => ChangeAutoLanguageCore(cultureInfo)); static void ChangeAutoLanguageCore(CultureInfo? cultureInfo = null) @@ -128,7 +112,7 @@ static CultureInfo TryGetCultureInfo(string? cultureName, CultureInfo defaultCul static void ChangeLanguageCore(string? cultureName) { - if (cultureName == null || IsMatch(AppResources.Culture, cultureName)) return; + if (cultureName == null || AppResources.Culture.IsMatch(cultureName)) return; AppResources.Culture = TryGetCultureInfo(cultureName, DefaultCurrentUICulture); Thread.CurrentThread.CurrentUICulture = AppResources.Culture; Thread.CurrentThread.CurrentCulture = AppResources.Culture; @@ -150,7 +134,7 @@ public static string GetCurrentCultureSteamLanguageName() var culture = Culture; foreach (var item in SteamLanguages) { - if (IsMatch(culture, item.Key)) + if (culture.IsMatch(item.Key)) { return item.Value; } @@ -195,7 +179,7 @@ static string GetLanguageCore() { if (!string.IsNullOrWhiteSpace(item.Key)) { - if (IsMatch(culture, item.Key)) + if (culture.IsMatch(item.Key)) { return item.Key; } diff --git a/src/ST.Client/UI/ViewModels/Pages/About/AboutPageViewModel.Mobile.cs b/src/ST.Client/UI/ViewModels/Pages/About/AboutPageViewModel.Mobile.cs index b83fb0ed992..2dab2bbae64 100644 --- a/src/ST.Client/UI/ViewModels/Pages/About/AboutPageViewModel.Mobile.cs +++ b/src/ST.Client/UI/ViewModels/Pages/About/AboutPageViewModel.Mobile.cs @@ -104,6 +104,7 @@ public static PreferenceButtonViewModel Create(PreferenceButton id, IDisposableH public static readonly string[] SourceRepositories = new[] { GitHub, Gitee }; public const string Title_0 = "Watt Toolkit "; public const string Title_1 = "2.0"; + public const string Title_2_ = " ({0} Steam++)"; public const string Developers_0 = "Developers: "; public const string Contributors_0 = "Contributors: "; public const string Separator = " - ";