summaryrefslogtreecommitdiff
path: root/server/src/matcher/find_lib.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-06 16:17:46 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-06 16:17:46 +0800
commite9d3e6555718311d3af8a8142ade7e706148805c (patch)
treef551fa1302f91155826e0f0692bf7cabb5d3a5d4 /server/src/matcher/find_lib.lua
parent3dacfb961183813bcdf63a51851efbe1ebd12641 (diff)
downloadlua-language-server-e9d3e6555718311d3af8a8142ade7e706148805c.zip
多语言
Diffstat (limited to 'server/src/matcher/find_lib.lua')
-rw-r--r--server/src/matcher/find_lib.lua15
1 files changed, 12 insertions, 3 deletions
diff --git a/server/src/matcher/find_lib.lua b/server/src/matcher/find_lib.lua
index 92d90e50..1690fe97 100644
--- a/server/src/matcher/find_lib.lua
+++ b/server/src/matcher/find_lib.lua
@@ -5,11 +5,20 @@ local function getLibs()
if Libs then
return Libs
end
+ local language = require 'language'
Libs = {}
for path in io.scan(ROOT / 'libs') do
- local buf = io.load(path)
- if buf then
- xpcall(lni.classics, log.error, buf, path:string(), {Libs})
+ if path:extension():string() == '.lni' then
+ local buf = io.load(path)
+ if buf then
+ local suc = xpcall(lni.classics, log.error, buf, path:string(), {Libs})
+ if suc then
+ local locale = io.load(path:parent_path() / (path:stem():string() .. '.' .. language))
+ if locale then
+ xpcall(lni.classics, log.error, locale, path:string(), {Libs})
+ end
+ end
+ end
end
end
return Libs