Skip to content

Commit 6aa49fa

Browse files
committed
locale
1 parent 66f2301 commit 6aa49fa

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

locale/en-us/script.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,12 @@ PLUGIN_TRUST_NO =
512512
Don't load this plugin
513513
]]
514514

515+
CLI_CHECK_ERROR_TYPE =
516+
'The argument of CHECK must be a string, but got {}'
517+
CLI_CHECK_ERROR_URI =
518+
'The argument of CHECK must be a valid uri, but got {}'
519+
CLI_CHECK_ERROR_LEVEL =
520+
'Checklevel must be one of: {}'
515521
CLI_CHECK_INITING =
516522
'Initializing ...'
517523
CLI_CHECK_SUCCESS =

locale/zh-cn/script.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,12 @@ PLUGIN_TRUST_NO =
511511
不要加载此插件
512512
]]
513513

514+
CLI_CHECK_ERROR_TYPE =
515+
'check 必须是一个字符串,但是是一个 {}'
516+
CLI_CHECK_ERROR_URI =
517+
'check 必须是一个有效的 URI,但是是 {}'
518+
CLI_CHECK_ERROR_LEVEL =
519+
'checklevel 必须是这些值之一:{}'
514520
CLI_CHECK_INITING =
515521
'正在初始化...'
516522
CLI_CHECK_SUCCESS =

script/cli/check.lua

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,27 @@ local json = require 'json-beautify'
88
local lang = require 'language'
99
local define = require 'proto.define'
1010
local config = require 'config.config'
11-
local timer = require 'timer'
12-
local platform = require 'bee.platform'
11+
12+
lang(LOCALE)
1313

1414
if type(CHECK) ~= 'string' then
15-
print(('The argument of CHECK must be a string, but got %s'):format(type(CHECK)))
15+
print(lang.script('CLI_CHECK_ERROR_TYPE', type(CHECK)))
16+
return
1617
end
1718

1819
local rootUri = furi.encode(CHECK)
1920
if not rootUri then
20-
print(('The argument of CHECK must be a valid uri, but got %s'):format(CHECK))
21+
print(lang.script('CLI_CHECK_ERROR_URI', CHECK))
22+
return
23+
end
24+
25+
if CHECKLEVEL then
26+
if not define.DiagnosticSeverity[CHECKLEVEL] then
27+
print(lang.script('CLI_CHECK_ERROR_LEVEL', 'Error, Warning, Information, Hint'))
28+
return
29+
end
2130
end
31+
local checkLevel = define.DiagnosticSeverity[CHECKLEVEL] or define.DiagnosticSeverity.Warning
2232

2333
util.enableCloseFunction()
2434

@@ -40,7 +50,6 @@ lclient():start(function (client)
4050

4151
ws.awaitReady(rootUri)
4252

43-
local checkLevel = define.DiagnosticSeverity[CHECKLEVEL] or define.DiagnosticSeverity.Warning
4453
local disables = config.get(rootUri, 'Lua.diagnostics.disable')
4554
for name, serverity in pairs(define.DiagnosticDefaultSeverity) do
4655
serverity = config.get(rootUri, 'Lua.diagnostics.severity')[name] or 'Warning'

0 commit comments

Comments
 (0)