Skip to content

Commit b625b34

Browse files
committed
update settings
1 parent 4464add commit b625b34

File tree

8 files changed

+69
-348
lines changed

8 files changed

+69
-348
lines changed

.vscode/launch.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323
"type": "lua",
2424
"request": "launch",
2525
"stopOnEntry": false,
26-
"program": "${workspaceRoot}/setting/build.lua",
26+
"program": "${workspaceRoot}/build-settings.lua",
2727
"arg": [
2828
],
2929
"luaexe": "${workspaceFolder}/server/bin/lua-language-server.exe",
30-
"path": "${workspaceFolder}/?.lua;${workspaceFolder}/server/script/?.lua;${workspaceFolder}/server/script/?/init.lua",
3130
"consoleCoding": "utf8",
3231
"sourceCoding": "utf8",
3332
"outputCapture": [
Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
local fs = require 'bee.filesystem'
22

3-
local json = require 'json-beautify'
3+
local currentPath = debug.getinfo(1, 'S').source:sub(2)
4+
local rootPath = currentPath:gsub('[^/\\]-$', '')
5+
package.path = package.path
6+
.. ';' .. rootPath .. '?.lua'
7+
.. ';' .. rootPath .. 'server/script/?.lua'
8+
9+
local json = require 'json-beautify'
410
local configuration = require 'package.configuration'
5-
local fsu = require 'fs-utility'
11+
local fsu = require 'fs-utility'
12+
local lloader = require 'locale-loader'
613

714
local function addSplited(t, key, value)
815
t[key] = value
@@ -43,11 +50,17 @@ local encodeOption = {
4350
newline = '\r\n',
4451
indent = ' ',
4552
}
46-
for _, lang in ipairs {'', '-zh-cn'} do
47-
local nls = require('package.nls' .. lang)
53+
54+
for dirPath in fs.pairs(fs.path 'server/locale') do
55+
local lang = dirPath:filename():string()
56+
local nlsPath = dirPath / 'setting.lua'
57+
local text = fsu.loadFile(nlsPath)
58+
if not text then
59+
goto CONTINUE
60+
end
61+
local nls = lloader(text, nlsPath:string())
4862

4963
local setting = {
50-
['$schema'] = '',
5164
title = 'setting',
5265
description = 'Setting of sumneko.lua',
5366
type = 'object',
@@ -56,5 +69,12 @@ for _, lang in ipairs {'', '-zh-cn'} do
5669
end),
5770
}
5871

72+
if lang == 'en-us' then
73+
lang = ''
74+
else
75+
lang = '-' .. lang
76+
end
77+
5978
fsu.saveFile(fs.path'setting/schema'..lang..'.json', json.beautify(setting, encodeOption))
79+
::CONTINUE::
6080
end

package/nls-example.lua

Lines changed: 0 additions & 59 deletions
This file was deleted.

package/nls-zh-cn.lua

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)