diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-07 15:58:55 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-07 15:58:55 +0800 |
commit | 3869c8fc53fb6e014ee6570a96429ea36c707ef9 (patch) | |
tree | cc979163cc0f1eecede64739bd8a5630984ebb5e /server | |
parent | 5dce334f3cf6bde54c2768e0e9da145b0f50024c (diff) | |
download | lua-language-server-3869c8fc53fb6e014ee6570a96429ea36c707ef9.zip |
支持多语言
Diffstat (limited to 'server')
-rw-r--r-- | server/src/language.lua | 8 | ||||
-rw-r--r-- | server/src/matcher/find_lib.lua | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/server/src/language.lua b/server/src/language.lua index da25a0b8..30acdadb 100644 --- a/server/src/language.lua +++ b/server/src/language.lua @@ -4,14 +4,14 @@ local function supportLanguage() local list = {} for path in (ROOT / 'locale'):list_directory() do if fs.is_directory(path) then - list[#list+1] = path:filename():string() + list[#list+1] = path:filename():string():lower() end end return list end local function osLanguage() - return '' + return LANG:lower() end local function getLanguage(id) @@ -33,8 +33,8 @@ end local function init() local id = osLanguage() local language = getLanguage(id) - log.info(('Os language: %s'):format(id)) - log.info(('Used language: %s'):format(language)) + log.info(('VSC language: %s'):format(id)) + log.info(('LSP language: %s'):format(language)) return language end diff --git a/server/src/matcher/find_lib.lua b/server/src/matcher/find_lib.lua index e2c124ab..e91568fc 100644 --- a/server/src/matcher/find_lib.lua +++ b/server/src/matcher/find_lib.lua @@ -96,9 +96,9 @@ local function getLibs() end local relative = fs.relative(path, ROOT) - local locale = loadLocale('enUS', relative) + local locale = loadLocale('en-US', relative) mergeLocale(libs, locale) - if language ~= 'enUS' then + if language ~= 'en-US' then locale = loadLocale(language, relative) mergeLocale(libs, locale) end |