summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--locale/en-US/script.lni13
-rw-r--r--locale/zh-CN/script.lni13
-rw-r--r--script-beta/core/completion.lua7
-rw-r--r--script-beta/core/hover/description.lua2
-rw-r--r--script-beta/core/hover/init.lua6
-rw-r--r--script-beta/core/hover/label.lua6
-rw-r--r--script-beta/files.lua3
7 files changed, 31 insertions, 19 deletions
diff --git a/locale/en-US/script.lni b/locale/en-US/script.lni
index 6e6dd9b8..88ad7a85 100644
--- a/locale/en-US/script.lni
+++ b/locale/en-US/script.lni
@@ -43,6 +43,8 @@ MWS_UCONFIG_FAILED = 'Saving user setting failed.'
MWS_UCONFIG_UPDATED = 'User setting updated.'
MWS_WCONFIG_UPDATED = 'Workspace setting updated.'
+WORKSPACE_SKIP_LARGE_FILE = 'Too large file: {} skipped. The currently set size limit is: {} KB, and the file size is: {} KB.'
+
PARSER_CRASH = 'Parser crashed! Last words:{}'
PARSER_UNKNOWN = 'Unknown syntax error...'
PARSER_MISS_NAME = '<name> expected.'
@@ -82,6 +84,7 @@ PARSER_ERR_DO_AS_THEN = 'Should use `do` .'
PARSER_MISS_END = 'Miss corresponding `end` .'
PARSER_ERR_COMMENT_PREFIX = 'Lua should use `--` for annotations.'
PARSER_MISS_SEP_IN_TABLE = 'Miss symbol `,` or `;` .'
+PARSER_SET_CONST = 'Assignment to const variable.'
SYMBOL_ANONYMOUS = '<Anonymous>'
@@ -100,9 +103,13 @@ HOVER_NATIVE_DOCUMENT_LUA53 = 'command:extension.lua.doc?["en-us/53/manual.h
HOVER_NATIVE_DOCUMENT_LUA54 = 'command:extension.lua.doc?["en-us/54/manual.html/{}"]'
HOVER_NATIVE_DOCUMENT_LUAJIT = 'command:extension.lua.doc?["en-us/51/manual.html/{}"]'
-HOVER_MULTI_PROTOTYPE = '({} prototypes)'
-HOVER_STRING_BYTES = '{} bytes'
-HOVER_STRING_CHARACTERS = '{} bytes, {} characters'
+HOVER_MULTI_PROTOTYPE = '({} prototypes)'
+HOVER_STRING_BYTES = '{} bytes'
+HOVER_STRING_CHARACTERS = '{} bytes, {} characters'
+HOVER_MULTI_DEF_PROTO = '({} definitions, {} prototypes)'
+HOVER_MULTI_PROTO_NOT_FUNC = '({} non functional definition)'
+
+HOVER_USE_LUA_PATH = '(Suppose the search path contains `{}`)'
ACTION_DISABLE_DIAG = 'Disable diagnostics ({}).'
ACTION_MARK_GLOBAL = 'Mark `{}` as defined global.'
diff --git a/locale/zh-CN/script.lni b/locale/zh-CN/script.lni
index 7934f8ff..7c223dd2 100644
--- a/locale/zh-CN/script.lni
+++ b/locale/zh-CN/script.lni
@@ -43,6 +43,8 @@ MWS_UCONFIG_FAILED = '用户配置保存失败。'
MWS_UCONFIG_UPDATED = '用户配置已更新。'
MWS_WCONFIG_UPDATED = '工作区配置已更新。'
+WORKSPACE_SKIP_LARGE_FILE = '已跳过过大的文件:{}。当前设置的大小限制为:{} KB,该文件大小为:{} KB'
+
PARSER_CRASH = '语法解析崩溃了!遗言:{}'
PARSER_UNKNOWN = '未知语法错误...'
PARSER_MISS_NAME = '缺少名称。'
@@ -82,6 +84,7 @@ PARSER_ERR_DO_AS_THEN = '应使用`do`。'
PARSER_MISS_END = '缺少对应的`end`。'
PARSER_ERR_COMMENT_PREFIX = 'Lua应使用`--`来进行注释。'
PARSER_MISS_SEP_IN_TABLE = '需要用`,`或`;`进行分割。'
+PARSER_SET_CONST = '不能对常量赋值。'
SYMBOL_ANONYMOUS = '<匿名函数>'
@@ -99,9 +102,13 @@ HOVER_NATIVE_DOCUMENT_LUA53 = 'command:extension.lua.doc?["zh-cn/53/manual.h
HOVER_NATIVE_DOCUMENT_LUA54 = 'command:extension.lua.doc?["en-us/54/manual.html/{}"]'
HOVER_NATIVE_DOCUMENT_LUAJIT = 'command:extension.lua.doc?["en-us/51/manual.html/{}"]'
-HOVER_MULTI_PROTOTYPE = '({} 个原型)'
-HOVER_STRING_BYTES = '{} 个字节'
-HOVER_STRING_CHARACTERS = '{} 个字节,{} 个字符'
+HOVER_MULTI_PROTOTYPE = '({} 个原型)'
+HOVER_STRING_BYTES = '{} 个字节'
+HOVER_STRING_CHARACTERS = '{} 个字节,{} 个字符'
+HOVER_MULTI_DEF_PROTO = '({} 个定义,{} 个原型)'
+HOVER_MULTI_PROTO_NOT_FUNC = '({} 个非函数定义)'
+
+HOVER_USE_LUA_PATH = '(假设搜索路径包含 `{}`)'
ACTION_DISABLE_DIAG = '禁用诊断({})。'
ACTION_MARK_GLOBAL = '标记 `{}` 为已定义的全局变量。'
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua
index fd27f535..2e1af2aa 100644
--- a/script-beta/core/completion.lua
+++ b/script-beta/core/completion.lua
@@ -19,6 +19,7 @@ local keyWordMap = require 'core.keyword'
local workspace = require 'workspace'
local furi = require 'file-uri'
local rpath = require 'workspace.require-path'
+local lang = require 'language'
local stackID = 0
local stacks = {}
@@ -593,11 +594,10 @@ local function checkUri(ast, text, offset, results)
}
}
end
- -- TODO 翻译
- collect[info.expect][#collect[info.expect]+1] = ([=[* [%s](%s) (假设搜索路径包含 `%s`)]=]):format(
+ collect[info.expect][#collect[info.expect]+1] = ([=[* [%s](%s) %s]=]):format(
path,
uri,
- info.searcher
+ lang.script('HOVER_USE_LUA_PATH', info.searcher)
)
end
end
@@ -620,7 +620,6 @@ local function checkUri(ast, text, offset, results)
}
}
end
- -- TODO 翻译
collect[path][#collect[path]+1] = ([=[[%s](%s)]=]):format(
path,
uri
diff --git a/script-beta/core/hover/description.lua b/script-beta/core/hover/description.lua
index 9e0066e6..8aa8a625 100644
--- a/script-beta/core/hover/description.lua
+++ b/script-beta/core/hover/description.lua
@@ -41,7 +41,7 @@ local function asString(source)
if searcher then
searcher = searcher:sub(#ws.path + 1)
searcher = ws.normalize(searcher)
- result[i] = ('* [%s](%s) (假设搜索路径包含 `%s`)'):format(path, uri, searcher)
+ result[i] = ('* [%s](%s) %s'):format(path, uri, lang.script('HOVER_USE_LUA_PATH', searcher))
else
result[i] = ('* [%s](%s)'):format(path, uri)
end
diff --git a/script-beta/core/hover/init.lua b/script-beta/core/hover/init.lua
index 46eb9b0b..52c684a8 100644
--- a/script-beta/core/hover/init.lua
+++ b/script-beta/core/hover/init.lua
@@ -5,6 +5,7 @@ local getLabel = require 'core.hover.label'
local getDesc = require 'core.hover.description'
local util = require 'utility'
local findSource = require 'core.find-source'
+local lang = require 'language'
local function getHoverAsFunction(source)
local values = vm.getInfers(source)
@@ -40,13 +41,12 @@ local function getHoverAsFunction(source)
}
end
- -- TODO 翻译
local lines = {}
if defs > 1 then
- lines[#lines+1] = ('(%d 个定义,%d 个原型)'):format(defs, protos)
+ lines[#lines+1] = lang.script('HOVER_MULTI_DEF_PROTO', defs, protos)
end
if other > 0 then
- lines[#lines+1] = ('(%d 个非函数定义)'):format(other)
+ lines[#lines+1] = lang.script('HOVER_MULTI_PROTO_NOT_FUNC', other)
end
if defs > 1 then
for label, count in util.sortPairs(labels) do
diff --git a/script-beta/core/hover/label.lua b/script-beta/core/hover/label.lua
index 91674023..2c5f0d2a 100644
--- a/script-beta/core/hover/label.lua
+++ b/script-beta/core/hover/label.lua
@@ -5,6 +5,7 @@ local buildTable = require 'core.hover.table'
local vm = require 'vm'
local util = require 'utility'
local guide = require 'parser.guide'
+local lang = require 'language'
local function asFunction(source, oop)
local name = buildName(source, oop)
@@ -100,11 +101,10 @@ local function asString(source)
end
local len = #str
local charLen = util.utf8Len(str, 1, -1)
- -- TODO 翻译
if len == charLen then
- return ('%d 个字节'):format(len)
+ return lang.script('HOVER_STRING_BYTES', len)
else
- return ('%d 个字节,%d 个字符'):format(len, charLen)
+ return lang.script('HOVER_STRING_CHARACTERS', len, charLen)
end
end
diff --git a/script-beta/files.lua b/script-beta/files.lua
index f88ca613..b1b069bc 100644
--- a/script-beta/files.lua
+++ b/script-beta/files.lua
@@ -201,8 +201,7 @@ function m.getAst(uri)
local ws = require 'workspace'
proto.notify('window/showMessage', {
type = 3,
- -- TODO 翻译
- message = lang.script('已跳过过大的文件:{}。当前设置的大小限制为:{} KB,该文件大小为:{} KB'
+ message = lang.script('WORKSPACE_SKIP_LARGE_FILE'
, ws.getRelativePath(file.uri)
, config.config.workspace.maxPreload
, #file.text / 1000