From 151e7cb41d8f8c0d6982a87de9f5fa70708957ab Mon Sep 17 00:00:00 2001 From: jilinge2 Date: Mon, 30 Sep 2024 15:59:48 +0800 Subject: [PATCH] add zhCN locale --- Localization.lua | 68 +++++++++++++++++++++++++++++++++++++++++++++ SuperAPI.lua | 14 +++++----- SuperAPI.toc | 4 ++- SuperAPIOptions.lua | 46 +++++++++++++++--------------- 4 files changed, 101 insertions(+), 31 deletions(-) create mode 100644 Localization.lua diff --git a/Localization.lua b/Localization.lua new file mode 100644 index 0000000..5771b85 --- /dev/null +++ b/Localization.lua @@ -0,0 +1,68 @@ +local L = AceLibrary("AceLocale-2.2"):new("SuperAPI") + +L:RegisterTranslations("enUS", function() return { + ["%d/511 Characters Used"] = true, + ["Shows whisper, party, raid, and battleground chat text in speech bubbles above characters' heads."] = true, + ["Show Whisper and Group Chat Bubbles"] = true, + ["|cffffcc00SuperAPI|cffffaaaa Loaded. Check the minimap icon for options."] = true, + ["Raw GUID logging enabled."] = true, + ["Raw GUID logging disabled."] = true, + + ["Always on"] = true, + ["Always off"] = true, + ["Shift to toggle on"] = true, + ["Shift to toggle off"] = true, + ["Default - incomplete circle"] = true, + ["Full circle (must download texture)"] = true, + ["Full circle with arrow for facing direction (must download texture)"] = true, + ["Classic incomplete circle oriented in facing direction"] = true, + ["Autoloot (Read tooltip)"] = true, + ["Specifies autoloot behavior. If using Vanilla Tweaks quickloot all of these will be reversed (always on will actually be always off, Shift to toggle on will be Shift to toggle off etc)."] = true, + ["Clickthrough corpses"] = true, + ["Allows you to click through corpses to loot corpses underneath them."] = true, + ["Field of view (Requires reload)"] = true, + ["Changes the field of view of the game. Requires reload to take effect."] = true, + ["Selection circle style"] = true, + ["Changes the style of the selection circle."] = true, + ["Background sound"] = true, + ["Allows game sound to play even when the window is in the background."] = true, + ["Uncapped sounds"] = true, + ["Allows more game sounds to play at the same time by removing hardcoded limit. This will also set SoundSoftwareChannels and SoundMaxHardwareChannels to 64. If you experience any weird crashes you may want to turn this off."] = true, + ["GUID Combat Log"] = true, + ["Changes the combat log to print GUIDs instead of names, will break a lot of addons."] = true, + } +end) + + +L:RegisterTranslations("zhCN", function() return { + ["%d/511 Characters Used"] = "已使用 %d/511 个字符", + ["Shows whisper, party, raid, and battleground chat text in speech bubbles above characters' heads."] = "显示密语、小队、团队和战场聊天文本在角色头顶的气泡中。", + ["Show Whisper and Group Chat Bubbles"] = "显示密语和团队聊天气泡", + ["|cffffcc00SuperAPI|cffffaaaa Loaded. Check the minimap icon for options."] = "|cffffcc00SuperAPI|cffffaaaa 已加载。使用小地图图标配置选项。", + ["Raw GUID logging enabled."] = "原始 GUID 日志记录已启用。", + ["Raw GUID logging disabled."] = "原始 GUID 日志记录已禁用。", + + ["Always on"] = "始终开启", + ["Always off"] = "始终关闭", + ["Shift to toggle on"] = "按Shift键开启", + ["Shift to toggle off"] = "按Shift键关闭", + ["Default - incomplete circle"] = "默认 - 不完整的圆,只显示视角方向的部分", + ["Full circle (must download texture)"] = "完整圆形(必须下载纹理)", + ["Full circle with arrow for facing direction (must download texture)"] = "带箭头指示方向的完整圆形(必须下载纹理)", + ["Classic incomplete circle oriented in facing direction"] = "经典不完整圆形,朝向方向", + ["Autoloot (Read tooltip)"] = "自动拾取", + ["Specifies autoloot behavior. If using Vanilla Tweaks quickloot all of these will be reversed (always on will actually be always off, Shift to toggle on will be Shift to toggle off etc)."] = "指定自动拾取行为。如果已使用Vanilla-Tweaks快速拾取,这些设置将会相反(开启自动拾取将会是不自动拾取,按Shift键开启将会是按Shift键关闭等)。", + ["Clickthrough corpses"] = "点击穿透尸体", + ["Allows you to click through corpses to loot corpses underneath them."] = "允许你点击穿透尸体以拾取下面的尸体。", + ["Field of view (Requires reload)"] = "视野范围(需要重载)", + ["Changes the field of view of the game. Requires reload to take effect."] = "改变游戏的视野范围。需要重载才能生效。", + ["Selection circle style"] = "选择目标脚下光圈样式", + ["Changes the style of the selection circle."] = "改变目标光圈的样式。", + ["Background sound"] = "背景声音", + ["Allows game sound to play even when the window is in the background."] = "即使窗口位于后台,也允许游戏声音播放。", + ["Uncapped sounds"] = "无限制声音", + ["Allows more game sounds to play at the same time by removing hardcoded limit. This will also set SoundSoftwareChannels and SoundMaxHardwareChannels to 64. If you experience any weird crashes you may want to turn this off."] = "通过移除硬编码限制,允许更多游戏声音同时播放。这也将设置SoundSoftwareChannels和SoundMaxHardwareChannels为64。如果你遇到任何奇怪的崩溃,你可能想要关闭这个。", + ["GUID Combat Log"] = "GUID战斗日志", + ["Changes the combat log to print GUIDs instead of names, will break a lot of addons."] = "将战斗日志更改为打印GUID而不是名称,将会破坏很多插件。", + } +end) \ No newline at end of file diff --git a/SuperAPI.lua b/SuperAPI.lua index b4aeaa6..17e108e 100644 --- a/SuperAPI.lua +++ b/SuperAPI.lua @@ -2,7 +2,7 @@ if not SetAutoloot then return end - +local L = AceLibrary("AceLocale-2.2"):new("SuperAPI") SUPERAPI_ContainerItemsTable = {} SuperAPI = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceDebug-2.0", "AceModuleCore-2.0", "AceConsole-2.0", "AceDB-2.0", "AceHook-2.1") @@ -13,11 +13,11 @@ function SuperAPI:OnEnable() -- Let macro frame allow 511 characters MacroFrame_LoadUI(); MacroFrameText:SetMaxLetters(511); - MACROFRAME_CHAR_LIMIT = "%d/511 Characters Used"; + MACROFRAME_CHAR_LIMIT = L["%d/511 Characters Used"]; -- Change chat bubbles options name - OPTION_TOOLTIP_PARTY_CHAT_BUBBLES = "Shows whisper, party, raid, and battleground chat text in speech bubbles above characters' heads."; - PARTY_CHAT_BUBBLES_TEXT = "Show Whisper and Group Chat Bubbles"; + OPTION_TOOLTIP_PARTY_CHAT_BUBBLES = L["Shows whisper, party, raid, and battleground chat text in speech bubbles above characters' heads."]; + PARTY_CHAT_BUBBLES_TEXT = L["Show Whisper and Group Chat Bubbles"]; SuperAPI.SetItemRefOriginal = SetItemRef SuperAPI.SpellButton_OnClickOriginal = SpellButton_OnClick @@ -43,7 +43,7 @@ function SuperAPI:OnEnable() SLASH_MACROTOOLTIP1 = "/tooltip" SlashCmdList["MACROTOOLTIP"] = function(cmd) end - DEFAULT_CHAT_FRAME:AddMessage("|cffffcc00SuperAPI|cffffaaaa Loaded. Check the minimap icon for options.") + DEFAULT_CHAT_FRAME:AddMessage(L["|cffffcc00SuperAPI|cffffaaaa Loaded. Check the minimap icon for options."]) end function SuperAPI:OnEvent() @@ -73,9 +73,9 @@ function SuperAPI:CombatLogGUID(on) end if LoggingCombat("RAW") == 1 then - DEFAULT_CHAT_FRAME:AddMessage("Raw GUID logging enabled.", info.r, info.g, info.b, info.id); + DEFAULT_CHAT_FRAME:AddMessage(L["Raw GUID logging enabled."], info.r, info.g, info.b, info.id); else - DEFAULT_CHAT_FRAME:AddMessage("Raw GUID logging disabled.", info.r, info.g, info.b, info.id); + DEFAULT_CHAT_FRAME:AddMessage(L["Raw GUID logging disabled."], info.r, info.g, info.b, info.id); end end diff --git a/SuperAPI.toc b/SuperAPI.toc index 3204821..bd32d47 100644 --- a/SuperAPI.toc +++ b/SuperAPI.toc @@ -1,6 +1,7 @@ ## Interface: 11200 -## Title: SuperAPI |cFFFF8080-balake-|r +## Title: [|CFF33AAFFSUPERWOW|R] SuperAPI |cFFFF8080-balake-|r ## Notes: the companion compatibility addon to the mod of the same name. +## Notes-zhCN: SuperWoW的配套兼容性插件。 ## Author: balake ## SavedVariablesPerCharacter: SuperAPIDB ## X-Embeds: Ace2, FuBarPlugin-2.0, CompostLib, DewDropLib, TabletLib @@ -21,5 +22,6 @@ libs\Dewdrop\Dewdrop-2.0.lua libs\Tablet\Tablet-2.0.lua libs\FuBarPlugin\FuBarPlugin-2.0.lua +Localization.lua SuperAPI.lua SuperAPIOptions.lua diff --git a/SuperAPIOptions.lua b/SuperAPIOptions.lua index c216ad6..2b335c2 100644 --- a/SuperAPIOptions.lua +++ b/SuperAPIOptions.lua @@ -2,19 +2,19 @@ if not SetAutoloot then return end - +local L = AceLibrary("AceLocale-2.2"):new("SuperAPI") SuperAPI.AUTOLOOT_OPTIONS = { - "Always on", - "Always off", - "Shift to toggle on", - "Shift to toggle off", + L["Always on"], + L["Always off"], + L["Shift to toggle on"], + L["Shift to toggle off"], } SuperAPI.SELECTION_CIRCLE_STYLE = { - "Default - incomplete circle", - "Full circle (must download texture)", - "Full circle with arrow for facing direction (must download texture)", - "Classic incomplete circle oriented in facing direction", + L["Default - incomplete circle"], + L["Full circle (must download texture)"], + L["Full circle with arrow for facing direction (must download texture)"], + L["Classic incomplete circle oriented in facing direction"], } SuperAPI:RegisterDefaults("profile", { @@ -45,8 +45,8 @@ SuperAPI.cmdtable = { args = { autoloot = { type = "text", - name = "Autoloot (Read tooltip)", - desc = "Specifies autoloot behavior. If using Vanilla Tweaks quickloot all of these will be reversed (always on will actually be always off, Shift to toggle on will be Shift to toggle off etc).", + name = L["Autoloot (Read tooltip)"], + desc = L["Specifies autoloot behavior. If using Vanilla Tweaks quickloot all of these will be reversed (always on will actually be always off, Shift to toggle on will be Shift to toggle off etc)."], order = 10, validate = SuperAPI.AUTOLOOT_OPTIONS, get = function() @@ -75,8 +75,8 @@ SuperAPI.cmdtable = { }, clickthrough = { type = "toggle", - name = "Clickthrough corpses", - desc = "Allows you to click through corpses to loot corpses underneath them.", + name = L["Clickthrough corpses"], + desc = L["Allows you to click through corpses to loot corpses underneath them."], order = 20, get = function() return Clickthrough() == 1 @@ -92,8 +92,8 @@ SuperAPI.cmdtable = { }, fov = { type = "range", - name = "Field of view (Requires reload)", - desc = "Changes the field of view of the game. Requires reload to take effect.", + name = L["Field of view (Requires reload)"], + desc = L["Changes the field of view of the game. Requires reload to take effect."], order = 30, min = 0.1, max = 3.14, @@ -107,8 +107,8 @@ SuperAPI.cmdtable = { }, selectioncircle = { type = "text", - name = "Selection circle style", - desc = "Changes the style of the selection circle.", + name = L["Selection circle style"], + desc = L["Changes the style of the selection circle."], order = 40, validate = SuperAPI.SELECTION_CIRCLE_STYLE, get = function() @@ -131,8 +131,8 @@ SuperAPI.cmdtable = { }, backgroundsound = { type = "toggle", - name = "Background sound", - desc = "Allows game sound to play even when the window is in the background.", + name = L["Background sound"], + desc = L["Allows game sound to play even when the window is in the background."], order = 60, get = function() return GetCVar("BackgroundSound") == "1" @@ -147,8 +147,8 @@ SuperAPI.cmdtable = { }, uncappedsounds = { type = "toggle", - name = "Uncapped sounds", - desc = "Allows more game sounds to play at the same time by removing hardcoded limit. This will also set SoundSoftwareChannels and SoundMaxHardwareChannels to 64. If you experience any weird crashes you may want to turn this off.", + name = L["Uncapped sounds"], + desc = L["Allows more game sounds to play at the same time by removing hardcoded limit. This will also set SoundSoftwareChannels and SoundMaxHardwareChannels to 64. If you experience any weird crashes you may want to turn this off."], order = 70, get = function() return GetCVar("UncapSounds") == "1" @@ -167,8 +167,8 @@ SuperAPI.cmdtable = { }, guidcombatlog = { type = "toggle", - name = "GUID Combat Log", - desc = "Changes the combat log to print GUIDs instead of names, will break a lot of addons.", + name = L["GUID Combat Log"], + desc = L["Changes the combat log to print GUIDs instead of names, will break a lot of addons."], order = 80, get = function() return LoggingCombat("RAW") == 1