-
Notifications
You must be signed in to change notification settings - Fork 3
/
set.lua
45 lines (44 loc) · 1.67 KB
/
set.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function init(plugin)
if app.apiVersion < 23 then
print("The version is too old,")
print("please upgrade to v1.3-rc3 or later.")
return
end
local script_name = debug.getinfo(1, "S").source:sub(2)
local script_path = script_name:match("(.*[/\\])")
if plugin.preferences.lang == nil then
plugin.preferences.lang = "en-us"
local Execution = assert(loadfile(script_path .. "langDialog.lua"))()
Execution(plugin)
end
local tempLang = {
["en-us"] = assert(loadfile(script_path .. "lang/en-us.lua"))(),
["zh-cn"] = assert(loadfile(script_path .. "lang/zh-cn.lua"))(),
["ja-jp"] = assert(loadfile(script_path .. "lang/ja-jp.lua"))()
}
local currentLang = plugin.preferences.lang
plugin:newCommand {
id = "Aserdecoration",
title = tempLang[currentLang].menuTitle,
group = "file_export_1",
onclick = function()
local Execution = assert(loadfile(script_path .. "Aserdecoration.lua"))()
Execution()
end
}
plugin:newCommand {
id = "AserdecorationLang",
title = tempLang[currentLang].changeLangMenuTitle,
group = "view_controls",
onclick = function()
local Execution = assert(loadfile(script_path .. "langDialog.lua"))()
Execution(plugin)
end
}
end
function exit(plugin)
local script_name = debug.getinfo(1, "S").source:sub(2)
local script_path = script_name:match("(.*[/\\])")
local tempLang = assert(loadfile(script_path .. "lang\\" .. plugin.preferences.lang .. ".lua"))()
print(tempLang.successfulExit)
end