From 3eff278428432a6e21ee71c1434d64390652bad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 8 Jul 2021 17:27:32 +0800 Subject: locale --- script/client.lua | 7 +++---- script/config/loader.lua | 8 ++++---- script/library.lua | 7 +++---- 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'script') diff --git a/script/client.lua b/script/client.lua index 00db9fce..f5078d48 100644 --- a/script/client.lua +++ b/script/client.lua @@ -135,14 +135,13 @@ function m.setConfig(changes, updateLocal) }) end else - -- TODO translate local messages = {} - messages[1] = lang.script('你的客户端不支持从服务侧修改设置,请手动修改如下设置:') + messages[1] = lang.script('WINDOW_CLIENT_NOT_SUPPORT_CONFIG') for _, change in ipairs(finalChanges) do if change.action == 'add' then - messages[#messages+1] = lang.script('为 `{key}` 添加值 `{value:q}`;', change) + messages[#messages+1] = lang.script('WINDOW_MANUAL_CONFIG_ADD', change) else - messages[#messages+1] = lang.script('将 `{key}` 的值设置为 `{value:q}`;', change) + messages[#messages+1] = lang.script('WINDOW_MANUAL_CONFIG_SET', change) end end local message = table.concat(messages, '\n') diff --git a/script/config/loader.lua b/script/config/loader.lua index 435b00d1..b0e8b6db 100644 --- a/script/config/loader.lua +++ b/script/config/loader.lua @@ -26,13 +26,13 @@ function m.loadLocalConfig(filename) local ext = path:extension():string():lower() local buf = fsu.loadFile(path) if not buf then - errorMessage(lang.script('无法读取设置文件:{}', path:string())) + errorMessage(lang.script('CONFIG_LOAD_FAILED', path:string())) return end if ext == '.json' then local suc, res = pcall(json.decode, buf) if not suc then - errorMessage(lang.script('设置文件加载错误:{}', res)) + errorMessage(lang.script('CONFIG_LOAD_ERROR', res)) return end return res @@ -41,12 +41,12 @@ function m.loadLocalConfig(filename) return assert(load(buf, '@' .. path:string(), 't'))() end) if not suc then - errorMessage(lang.script('设置文件加载错误:{}', res)) + errorMessage(lang.script('CONFIG_LOAD_ERROR', res)) return end return res else - errorMessage(lang.script('设置文件必须是lua或json格式:{}', path:string())) + errorMessage(lang.script('CONFIG_TYPE_ERROR', path:string())) return end end diff --git a/script/library.lua b/script/library.lua index 4a40fead..3cb4cb10 100644 --- a/script/library.lua +++ b/script/library.lua @@ -320,12 +320,11 @@ end local hasAsked local function askFor3rd(cfg) hasAsked = true - -- TODO: translate - local yes1 = lang.script['应用并修改设置'] - local yes2 = lang.script['应用但不修改设置'] + local yes1 = lang.script.WINDOW_APPLY_WHIT_SETTING + local yes2 = lang.script.WINDOW_APPLY_WHITOUT_SETTING local no = lang.script.WINDOW_DONT_SHOW_AGAIN local result = client.awaitRequestMessage('Info' - , lang.script('是否需要将你的工作环境配置为 `{}` ?', cfg.name) + , lang.script('WINDOW_ASK_APPLY_LIBRARY', cfg.name) , {yes1, yes2, no} ) if not result then -- cgit v1.2.3