diff --git a/Starward.Core/EnumExtension.cs b/Starward.Core/EnumExtension.cs index 9a1dfe46f..c70b96be1 100644 --- a/Starward.Core/EnumExtension.cs +++ b/Starward.Core/EnumExtension.cs @@ -81,15 +81,15 @@ public static string ToLocalization(this GachaType gachaType) { return gachaType switch { - GachaType.StellarWarp => Lang.GachaType_StellarWarp, - GachaType.DepartureWarp => Lang.GachaType_DepartureWarp, - GachaType.CharacterEventWarp => Lang.GachaType_CharacterEventWarp, - GachaType.LightConeEventWarp => Lang.GachaType_LightConeEventWarp, - GachaType.NoviceWish => Lang.GachaType_NoviceWish, - GachaType.PermanentWish => Lang.GachaType_PermanentWish, - GachaType.CharacterEventWish => Lang.GachaType_CharacterEventWish, - GachaType.CharacterEventWish_2 => Lang.GachaType_CharacterEventWish_2, - GachaType.WeaponEventWish => Lang.GachaType_WeaponEventWish, + GachaType.StellarWarp => CoreLang.GachaType_StellarWarp, + GachaType.DepartureWarp => CoreLang.GachaType_DepartureWarp, + GachaType.CharacterEventWarp => CoreLang.GachaType_CharacterEventWarp, + GachaType.LightConeEventWarp => CoreLang.GachaType_LightConeEventWarp, + GachaType.NoviceWish => CoreLang.GachaType_NoviceWish, + GachaType.PermanentWish => CoreLang.GachaType_PermanentWish, + GachaType.CharacterEventWish => CoreLang.GachaType_CharacterEventWish, + GachaType.CharacterEventWish_2 => CoreLang.GachaType_CharacterEventWish_2, + GachaType.WeaponEventWish => CoreLang.GachaType_WeaponEventWish, _ => "", }; } @@ -100,9 +100,9 @@ public static string ToLocalization(this PostType postType) { return postType switch { - PostType.POST_TYPE_ACTIVITY => Lang.PostType_Activity, - PostType.POST_TYPE_ANNOUNCE => Lang.PostType_Announcement, - PostType.POST_TYPE_INFO => Lang.PostType_Information, + PostType.POST_TYPE_ACTIVITY => CoreLang.PostType_Activity, + PostType.POST_TYPE_ANNOUNCE => CoreLang.PostType_Announcement, + PostType.POST_TYPE_INFO => CoreLang.PostType_Information, _ => "", }; } diff --git a/Starward.Core/Gacha/Genshin/GenshinGachaClient.cs b/Starward.Core/Gacha/Genshin/GenshinGachaClient.cs index e89e7ccfc..45ea14acc 100644 --- a/Starward.Core/Gacha/Genshin/GenshinGachaClient.cs +++ b/Starward.Core/Gacha/Genshin/GenshinGachaClient.cs @@ -55,7 +55,7 @@ protected override string GetGachaUrlPrefix(string gachaUrl, string? lang = null } return gachaUrl; } - throw new ArgumentException(Lang.Core_CannotParseTheWishRecordURL); + throw new ArgumentException(CoreLang.Gacha_CannotParseTheWishRecordURL); } diff --git a/Starward.Core/Gacha/StarRail/StarRailGachaClient.cs b/Starward.Core/Gacha/StarRail/StarRailGachaClient.cs index 16538acc2..f1dfe8026 100644 --- a/Starward.Core/Gacha/StarRail/StarRailGachaClient.cs +++ b/Starward.Core/Gacha/StarRail/StarRailGachaClient.cs @@ -55,7 +55,7 @@ protected override string GetGachaUrlPrefix(string gachaUrl, string? lang = null } return gachaUrl; } - throw new ArgumentException(Lang.Core_CannotParseTheWarpRecordURL); + throw new ArgumentException(CoreLang.Gacha_CannotParseTheWarpRecordURL); } diff --git a/Starward.Core/GlobalUsing.cs b/Starward.Core/GlobalUsing.cs index 977cee56a..0ca645847 100644 --- a/Starward.Core/GlobalUsing.cs +++ b/Starward.Core/GlobalUsing.cs @@ -1 +1 @@ -global using Starward.Language; \ No newline at end of file +global using Starward.Core.Localization; \ No newline at end of file diff --git a/Starward.Core/Localization/CoreLang.Designer.cs b/Starward.Core/Localization/CoreLang.Designer.cs new file mode 100644 index 000000000..b1c50f161 --- /dev/null +++ b/Starward.Core/Localization/CoreLang.Designer.cs @@ -0,0 +1,189 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace Starward.Core.Localization { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class CoreLang { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal CoreLang() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Starward.Core.Localization.CoreLang", typeof(CoreLang).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找类似 Cannot parse the warp record URL. 的本地化字符串。 + /// + internal static string Gacha_CannotParseTheWarpRecordURL { + get { + return ResourceManager.GetString("Gacha_CannotParseTheWarpRecordURL", resourceCulture); + } + } + + /// + /// 查找类似 Cannot parse the wish record URL. 的本地化字符串。 + /// + internal static string Gacha_CannotParseTheWishRecordURL { + get { + return ResourceManager.GetString("Gacha_CannotParseTheWishRecordURL", resourceCulture); + } + } + + /// + /// 查找类似 Character Event Warp 的本地化字符串。 + /// + internal static string GachaType_CharacterEventWarp { + get { + return ResourceManager.GetString("GachaType_CharacterEventWarp", resourceCulture); + } + } + + /// + /// 查找类似 Character Event Wish 的本地化字符串。 + /// + internal static string GachaType_CharacterEventWish { + get { + return ResourceManager.GetString("GachaType_CharacterEventWish", resourceCulture); + } + } + + /// + /// 查找类似 Character Event Wish - 2 的本地化字符串。 + /// + internal static string GachaType_CharacterEventWish_2 { + get { + return ResourceManager.GetString("GachaType_CharacterEventWish_2", resourceCulture); + } + } + + /// + /// 查找类似 Departure Warp 的本地化字符串。 + /// + internal static string GachaType_DepartureWarp { + get { + return ResourceManager.GetString("GachaType_DepartureWarp", resourceCulture); + } + } + + /// + /// 查找类似 Light Cone Event Warp 的本地化字符串。 + /// + internal static string GachaType_LightConeEventWarp { + get { + return ResourceManager.GetString("GachaType_LightConeEventWarp", resourceCulture); + } + } + + /// + /// 查找类似 Novice Wish 的本地化字符串。 + /// + internal static string GachaType_NoviceWish { + get { + return ResourceManager.GetString("GachaType_NoviceWish", resourceCulture); + } + } + + /// + /// 查找类似 Permanent Wish 的本地化字符串。 + /// + internal static string GachaType_PermanentWish { + get { + return ResourceManager.GetString("GachaType_PermanentWish", resourceCulture); + } + } + + /// + /// 查找类似 Stellar Warp 的本地化字符串。 + /// + internal static string GachaType_StellarWarp { + get { + return ResourceManager.GetString("GachaType_StellarWarp", resourceCulture); + } + } + + /// + /// 查找类似 Weapon Event Wish 的本地化字符串。 + /// + internal static string GachaType_WeaponEventWish { + get { + return ResourceManager.GetString("GachaType_WeaponEventWish", resourceCulture); + } + } + + /// + /// 查找类似 Events 的本地化字符串。 + /// + internal static string PostType_Activity { + get { + return ResourceManager.GetString("PostType_Activity", resourceCulture); + } + } + + /// + /// 查找类似 Notices 的本地化字符串。 + /// + internal static string PostType_Announcement { + get { + return ResourceManager.GetString("PostType_Announcement", resourceCulture); + } + } + + /// + /// 查找类似 Info 的本地化字符串。 + /// + internal static string PostType_Information { + get { + return ResourceManager.GetString("PostType_Information", resourceCulture); + } + } + } +} diff --git a/Starward.Core/Localization/CoreLang.resx b/Starward.Core/Localization/CoreLang.resx new file mode 100644 index 000000000..4fd10619b --- /dev/null +++ b/Starward.Core/Localization/CoreLang.resx @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Character Event Warp + + + Character Event Wish + + + Character Event Wish - 2 + + + Departure Warp + + + Light Cone Event Warp + + + Novice Wish + + + Permanent Wish + + + Stellar Warp + + + Weapon Event Wish + + + Cannot parse the warp record URL. + + + Cannot parse the wish record URL. + + + Events + + + Notices + + + Info + + \ No newline at end of file diff --git a/Starward.Core/Localization/CoreLang.zh-CN.resx b/Starward.Core/Localization/CoreLang.zh-CN.resx new file mode 100644 index 000000000..79e7b2286 --- /dev/null +++ b/Starward.Core/Localization/CoreLang.zh-CN.resx @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 角色活动跃迁 + + + 角色活动祈愿 + + + 角色活动祈愿-2 + + + 始发跃迁 + + + 光锥活动跃迁 + + + 新手祈愿 + + + 常驻祈愿 + + + 群星跃迁 + + + 武器活动祈愿 + + + 无法解析跃迁记录的 URL + + + 无法解析祈愿记录的 URL + + + 活动 + + + 公告 + + + 资讯 + + \ No newline at end of file diff --git a/Starward.Core/Starward.Core.csproj b/Starward.Core/Starward.Core.csproj index 2c9b6dcbd..6faccc479 100644 --- a/Starward.Core/Starward.Core.csproj +++ b/Starward.Core/Starward.Core.csproj @@ -7,7 +7,18 @@ - + + True + True + CoreLang.resx + + + + + + ResXFileCodeGenerator + CoreLang.Designer.cs +