[O] Locale

This commit is contained in:
Clansty
2024-11-27 03:35:01 +08:00
parent 2646f642b5
commit 054352356b
5 changed files with 76 additions and 15 deletions

View File

@@ -28,7 +28,7 @@ namespace AquaMai.Core.Resources {
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public Locale() { internal Locale() {
} }
/// <summary> /// <summary>
@@ -161,7 +161,7 @@ namespace AquaMai.Core.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to 游玩次数{0}. /// Looks up a localized string similar to Play Count{0}.
/// </summary> /// </summary>
public static string PlayCount { public static string PlayCount {
get { get {
@@ -169,6 +169,15 @@ namespace AquaMai.Core.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Playlog save error.
/// </summary>
public static string PlaylogSaveError {
get {
return ResourceManager.GetString("PlaylogSaveError", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to SSS+ =&gt; DXRating += {0}. /// Looks up a localized string similar to SSS+ =&gt; DXRating += {0}.
/// </summary> /// </summary>
@@ -259,6 +268,24 @@ namespace AquaMai.Core.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Hide Self-Made Charts.
/// </summary>
public static string SelfMadeChartsHide {
get {
return ResourceManager.GetString("SelfMadeChartsHide", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show Self-Made Charts.
/// </summary>
public static string SelfMadeChartsShow {
get {
return ResourceManager.GetString("SelfMadeChartsShow", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Skip. /// Looks up a localized string similar to Skip.
/// </summary> /// </summary>
@@ -312,5 +339,14 @@ namespace AquaMai.Core.Resources {
return ResourceManager.GetString("SpeedUp", resourceCulture); return ResourceManager.GetString("SpeedUp", resourceCulture);
} }
} }
/// <summary>
/// Looks up a localized string similar to UserAll Upsert Error.
/// </summary>
public static string UserAllUpsertError {
get {
return ResourceManager.GetString("UserAllUpsertError", resourceCulture);
}
}
} }
} }

View File

@@ -102,6 +102,18 @@
<value>You are using AquaMai CI build version. This version is built from the latest mainline code and may contain undocumented configuration changes or potential issues.</value> <value>You are using AquaMai CI build version. This version is built from the latest mainline code and may contain undocumented configuration changes or potential issues.</value>
</data> </data>
<data name="PlayCount" xml:space="preserve"> <data name="PlayCount" xml:space="preserve">
<value>游玩次数{0}</value> <value>Play Count{0}</value>
</data>
<data name="SelfMadeChartsHide" xml:space="preserve">
<value>Hide Self-Made Charts</value>
</data>
<data name="SelfMadeChartsShow" xml:space="preserve">
<value>Show Self-Made Charts</value>
</data>
<data name="UserAllUpsertError" xml:space="preserve">
<value>UserAll Upsert Error</value>
</data>
<data name="PlaylogSaveError" xml:space="preserve">
<value>Playlog save error</value>
</data> </data>
</root> </root>

View File

@@ -95,6 +95,18 @@
<value>您正在使用的是 AquaMai CI 构建版本。由于该版本基于最新的主线代码构建,可能包含未通知的配置文件变更或潜在问题。</value> <value>您正在使用的是 AquaMai CI 构建版本。由于该版本基于最新的主线代码构建,可能包含未通知的配置文件变更或潜在问题。</value>
</data> </data>
<data name="PlayCount" xml:space="preserve"> <data name="PlayCount" xml:space="preserve">
<value>Play Count: {0}</value> <value>游玩次数: {0}</value>
</data>
<data name="SelfMadeChartsHide" xml:space="preserve">
<value>已隐藏所有自制谱</value>
</data>
<data name="SelfMadeChartsShow" xml:space="preserve">
<value>已显示自制谱</value>
</data>
<data name="UserAllUpsertError" xml:space="preserve">
<value>保存 UserAll 失败</value>
</data>
<data name="PlaylogSaveError" xml:space="preserve">
<value>保存 Playlog 失败</value>
</data> </data>
</root> </root>

View File

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using AquaMai.Config.Attributes; using AquaMai.Config.Attributes;
using AquaMai.Config.Types; using AquaMai.Config.Types;
using AquaMai.Core.Helpers; using AquaMai.Core.Helpers;
using AquaMai.Core.Resources;
using HarmonyLib; using HarmonyLib;
using MAI2.Util; using MAI2.Util;
using Manager; using Manager;
@@ -25,8 +26,7 @@ public class HideSelfMadeCharts
zh: "切换自制谱显示的按键")] zh: "切换自制谱显示的按键")]
public static readonly KeyCodeOrName key = KeyCodeOrName.Test; public static readonly KeyCodeOrName key = KeyCodeOrName.Test;
[ConfigEntry] [ConfigEntry] public static readonly bool longPress = false;
public static readonly bool longPress = false;
[ConfigEntry( [ConfigEntry(
en: "One user ID per line in the file. Hide self-made charts when these users login.", en: "One user ID per line in the file. Hide self-made charts when these users login.",
@@ -86,7 +86,7 @@ public class HideSelfMadeCharts
Task.Run(async () => Task.Run(async () =>
{ {
await Task.Delay(1000); await Task.Delay(1000);
MessageHelper.ShowMessage($"{(isShowSelfMadeCharts ? "Show" : "Hide")} Self-Made Charts"); MessageHelper.ShowMessage(isShowSelfMadeCharts ? Locale.SelfMadeChartsShow : Locale.SelfMadeChartsHide);
}); });
} }
@@ -133,4 +133,4 @@ public class HideSelfMadeCharts
// reset status on login // reset status on login
isShowSelfMadeCharts = true; isShowSelfMadeCharts = true;
} }
} }

View File

@@ -53,6 +53,7 @@ public class ImmediateSave
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
var j = i;
var userData = Singleton<UserDataManager>.Instance.GetUserData(i); var userData = Singleton<UserDataManager>.Instance.GetUserData(i);
if (!userData.IsEntry || userData.IsGuest()) if (!userData.IsEntry || userData.IsGuest())
{ {
@@ -74,10 +75,10 @@ public class ImmediateSave
}, },
delegate(PacketStatus err) delegate(PacketStatus err)
{ {
SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, i); SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, j);
MelonLogger.Error("[ImmediateSave] Playlog save error"); MelonLogger.Error("[ImmediateSave] Playlog save error");
MelonLogger.Error(err); MelonLogger.Error(err);
MessageHelper.ShowMessage("Playlog save error"); MessageHelper.ShowMessage(Locale.PlaylogSaveError);
CheckSaveDone(); CheckSaveDone();
})); }));
PacketHelper.StartPacket(Shim.CreatePacketUpsertUserAll(i, userData, delegate(int code) PacketHelper.StartPacket(Shim.CreatePacketUpsertUserAll(i, userData, delegate(int code)
@@ -89,18 +90,18 @@ public class ImmediateSave
} }
else else
{ {
SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, i); SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, j);
MelonLogger.Error("[ImmediateSave] UserAll upsert error"); MelonLogger.Error("[ImmediateSave] UserAll upsert error");
MelonLogger.Error(code); MelonLogger.Error(code);
MessageHelper.ShowMessage("UserAll upsert error"); MessageHelper.ShowMessage(Locale.UserAllUpsertError);
CheckSaveDone(); CheckSaveDone();
} }
}, delegate(PacketStatus err) }, delegate(PacketStatus err)
{ {
SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, i); SoundManager.PlaySE(Mai2.Mai2Cue.Cue.SE_ENTRY_AIME_ERROR, j);
MelonLogger.Error("[ImmediateSave] UserAll upsert error"); MelonLogger.Error("[ImmediateSave] UserAll upsert error");
MelonLogger.Error(err); MelonLogger.Error(err);
MessageHelper.ShowMessage("UserAll upsert error"); MessageHelper.ShowMessage(Locale.UserAllUpsertError);
CheckSaveDone(); CheckSaveDone();
})); }));
} }
@@ -237,4 +238,4 @@ public class ImmediateSave
GUI.Label(rect, Locale.SavingDontExit); GUI.Label(rect, Locale.SavingDontExit);
} }
} }
} }