Skip to content

Commit

Permalink
Add About_FormerName
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed May 16, 2022
1 parent 7b247ac commit fe67395
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 76 deletions.
2 changes: 1 addition & 1 deletion README.en.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1 align="center">Watt Toolkit 🧰</h1>
<h1 align="center">Watt Toolkit 🧰 (Former name Steam++)</h1>

<div align="center">

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1 align="center">Watt Toolkit 🧰</h1>
<h1 align="center">Watt Toolkit 🧰 (原名 Steam++)</h1>

<div align="center">

Expand Down
16 changes: 8 additions & 8 deletions src/Common.CoreLib/Extensions/CultureInfoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
2 changes: 1 addition & 1 deletion src/Common.CoreLib/Properties/InternalsVisibleTo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
[assembly: InternalsVisibleTo("System.Application.SteamTools.Client.Droid.UnitTest.App" + PublicKey)]
21 changes: 0 additions & 21 deletions src/FDELauncher/Compat/CultureInfo2.cs

This file was deleted.

21 changes: 21 additions & 0 deletions src/FDELauncher/Compat/CultureInfoExtensions.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
}
14 changes: 7 additions & 7 deletions src/FDELauncher/Properties/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ public static CultureInfo Culture
public static string GetString(Func<Language, string> 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);
Expand Down
10 changes: 8 additions & 2 deletions src/ST.Client.Android/UI/Controllers/AboutController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand All @@ -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;
}

Expand Down
9 changes: 9 additions & 0 deletions src/ST.Client/UI/Resx/AppResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 19 additions & 15 deletions src/ST.Client/UI/Resx/AppResources.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@
<comment>Comment=;Author=deepl</comment>
</data>
<data name="CommunityFix_ProxyMode_WinSystemTip" xml:space="preserve">
<value>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&apos;t be needing this mode.</value>
<value>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.</value>
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="CommunityFix_ScriptManage" xml:space="preserve">
Expand Down Expand Up @@ -430,7 +430,7 @@
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="DelAccountTips" xml:space="preserve">
<value>Your account information will be permanently deleted and you cannot log in again using this account&apos;s credentials. Ready to deactivate your account?</value>
<value>Your account information will be permanently deleted and you cannot log in again using this account's credentials. Ready to deactivate your account?</value>
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="Delete" xml:space="preserve">
Expand Down Expand Up @@ -730,7 +730,7 @@
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="GameRelated_Borderless_ToWallerpaperTip" xml:space="preserve">
<value>*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 &apos;Refresh wallpaper&apos; 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.</value>
<value>*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.</value>
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="Gender" xml:space="preserve">
Expand Down Expand Up @@ -858,7 +858,7 @@
<comment>Comment=同意 or 取消;Author=沙中金</comment>
</data>
<data name="LocalAuth_AuthTrade_GetError" xml:space="preserve">
<value>You don&apos;t have permission to view confirmation messages. Check if you have enabled &apos;community-generated content&apos; in Family View.</value>
<value>You don't have permission to view confirmation messages. Check if you have enabled 'community-generated content' in Family View.</value>
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="LocalAuth_AuthTrade_GetError2" xml:space="preserve">
Expand Down Expand Up @@ -994,7 +994,7 @@
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="LocalAuth_ProtectionAuth_IsOnlyCurrentComputerEncryptTip" xml:space="preserve">
<value>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&apos;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.</value>
<value>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.</value>
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="LocalAuth_ProtectionAuth_NoChangeTip" xml:space="preserve">
Expand Down Expand Up @@ -1042,7 +1042,7 @@
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="LocalAuth_SDATip" xml:space="preserve">
<value>A desktop implementation of Steam Authenticator. Please import from file named &apos;maFile&apos; in &apos;maFiles&apos; folders under SDA path. (Encrypted files not supported. Remove password before continuing)</value>
<value>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)</value>
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="LocalAuth_ShowAuthCode" xml:space="preserve">
Expand Down Expand Up @@ -1078,7 +1078,7 @@
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="LocalAuth_SteamGuardTip" xml:space="preserve">
<value>In the &apos;files&apos; folder, open the &apos;SteamGuard-NNNNNNNNN&apos; file and paste the entire contents of the file</value>
<value>In the 'files' folder, open the 'SteamGuard-NNNNNNNNN' file and paste the entire contents of the file</value>
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="LocalAuth_SteamToolsImport" xml:space="preserve">
Expand Down Expand Up @@ -1114,7 +1114,7 @@
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="LocalAuth_SteamuuidTip" xml:space="preserve">
<value>In &apos;shared_prefs&apos; folder, paste uuidKey from &apos;steam_uuid.xml&apos;</value>
<value>In 'shared_prefs' folder, paste uuidKey from 'steam_uuid.xml'</value>
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="LocalAuth_SyncTime" xml:space="preserve">
Expand All @@ -1126,7 +1126,7 @@
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="LocalAuth_WinAuthTip" xml:space="preserve">
<value>WinAuth is Windows&apos; 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.</value>
<value>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.</value>
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="Lock" xml:space="preserve">
Expand Down Expand Up @@ -1170,7 +1170,7 @@
<comment>Comment=;Author=沙中金</comment>
</data>
<data name="My" xml:space="preserve">
<value>It&apos;s mine</value>
<value>It's mine</value>
<comment>Comment=;Author=MicrosoftTranslator</comment>
</data>
<data name="NextStep" xml:space="preserve">
Expand Down Expand Up @@ -2437,7 +2437,7 @@ Are you really sure?</value>
</data>
<data name="Achievement_Warning_2" xml:space="preserve">
<value>Error code: {0}
An error occurred while retrieving achievement statistics, either because the game doesn&apos;t have achievements, or you don&apos;t have the game.</value>
An error occurred while retrieving achievement statistics, either because the game doesn't have achievements, or you don't have the game.</value>
<comment>Comment=;Author=MicrosoftTranslator</comment>
</data>
<data name="ASF_RedeemKey_InputKey_Watermark" xml:space="preserve">
Expand Down Expand Up @@ -2467,7 +2467,7 @@ This action ends with a running Steam jump to the new account login window.</val
<comment>Comment=;Author=AigioL</comment>
</data>
<data name="About_Donate_Desc" xml:space="preserve">
<value>The release of the current version of Watt Toolkit can&apos;t be separated from everyone&apos;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.
<value>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.</value>
<comment>Comment=;Author=AigioL</comment>
</data>
Expand Down Expand Up @@ -2496,7 +2496,7 @@ This action ends with a running Steam jump to the new account login window.</val
<comment>Comment=;Author=MicrosoftTranslator</comment>
</data>
<data name="Steam_ImageCodeShowError" xml:space="preserve">
<value>Can&apos;t display image verification codes?</value>
<value>Can't display image verification codes?</value>
<comment>Comment=;Author=MicrosoftTranslator</comment>
</data>
<data name="UserChange_ShowHideUserName" xml:space="preserve">
Expand Down Expand Up @@ -2833,7 +2833,7 @@ The system will {1} after {0} seconds.</value>
<comment>Comment=;Author=MicrosoftTranslator</comment>
</data>
<data name="OpenTheAuthorPageInBrowser" xml:space="preserve">
<value>Check out more of this author&apos;s work</value>
<value>Check out more of this author's work</value>
<comment>Comment=;Author=MicrosoftTranslator</comment>
</data>
<data name="GetImageFromSteamGridDB" xml:space="preserve">
Expand Down Expand Up @@ -2944,4 +2944,8 @@ The system will {1} after {0} seconds.</value>
<value>Vertical cover</value>
<comment>Comment=;Author=MicrosoftTranslator</comment>
</data>
</root>
<data name="About_FormerName" xml:space="preserve">
<value>Former name</value>
<comment>Comment=;Author=AigioL</comment>
</data>
</root>
3 changes: 3 additions & 0 deletions src/ST.Client/UI/Resx/AppResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2260,4 +2260,7 @@ AAAAA-BBBBB-CCCC3</value>
<data name="CommunityFix_CertificateStatus" xml:space="preserve">
<value>证书状态</value>
</data>
<data name="About_FormerName" xml:space="preserve">
<value>原名</value>
</data>
</root>
24 changes: 4 additions & 20 deletions src/ST.Client/UI/Resx/R.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit fe67395

Please sign in to comment.