新语言:机翻

语言模块升级
支持更自由地添加语言(不再使用语言序号)
给getTip设置metatable的代码移出模块
This commit is contained in:
MrZ626
2021-09-20 20:25:17 +08:00
parent 493fcb2f05
commit 7393b3c716
14 changed files with 1053 additions and 107 deletions

View File

@@ -1,12 +1,14 @@
local langList={
"中文",
"全中文",
"就这?",
"English",
"Français",
"Español",
"Português",
"?????",
zh="中文",
zh2="全中文",
en="English",
fr="Français",
es="Español",
pt="Português",
grass="机翻",
yygq="就这?",
symbol="?????",
}
local scene={}
@@ -15,22 +17,23 @@ function scene.sceneBack()
saveSettings()
end
local function _setLang(n)
SETTING.lang=n
LANG.set(n)
local function _setLang(lid)
SETTING.locale=lid
applyLanguage()
TEXT.clear()
TEXT.show(langList[n],640,500,100,'appear',.626)
TEXT.show(langList[lid],640,500,100,'appear',.626)
collectgarbage()
end
scene.widgetList={
WIDGET.newButton{x=200,y=100,w=200,h=120,fText=langList[1],color='R',font=35,code=function()_setLang(1)end},
WIDGET.newButton{x=420,y=100,w=200,h=120,fText=langList[2],color='dR',font=35,code=function()_setLang(2)end},
WIDGET.newButton{x=640,y=100,w=200,h=120,fText=langList[3],color='D',font=35,code=function()_setLang(3)end},
WIDGET.newButton{x=860,y=100,w=200,h=120,fText=langList[4],color='N',font=35,code=function()_setLang(4)end},
WIDGET.newButton{x=1080,y=100,w=200,h=120,fText=langList[5],color='lW',font=35,code=function()_setLang(5)end},
WIDGET.newButton{x=200,y=250,w=200,h=120,fText=langList[6],color='O',font=35,code=function()_setLang(6)end},
WIDGET.newButton{x=420,y=250,w=200,h=120,fText=langList[7],color='Y',font=35,code=function()_setLang(7)end},
WIDGET.newButton{x=640,y=250,w=200,h=120,fText=langList[8],color='dH',font=35,code=function()_setLang(8)end},
WIDGET.newButton{x=200,y=100,w=200,h=120,fText=langList.zh, color='R', font=35,code=function()_setLang('zh')end},
WIDGET.newButton{x=420,y=100,w=200,h=120,fText=langList.zh2, color='dR',font=35,code=function()_setLang('zh2')end},
WIDGET.newButton{x=640,y=100,w=200,h=120,fText=langList.en, color='N', font=35,code=function()_setLang('en')end},
WIDGET.newButton{x=860,y=100,w=200,h=120,fText=langList.fr, color='lW',font=35,code=function()_setLang('fr')end},
WIDGET.newButton{x=1080,y=100,w=200,h=120,fText=langList.es, color='O', font=35,code=function()_setLang('es')end},
WIDGET.newButton{x=200,y=250,w=200,h=120,fText=langList.pt, color='Y', font=35,code=function()_setLang('pt')end},
WIDGET.newButton{x=200,y=550,w=200,h=120,fText=langList.grass, color='lG',font=35,code=function()_setLang('grass')end},
WIDGET.newButton{x=420,y=550,w=200,h=120,fText=langList.yygq, color='D', font=35,code=function()_setLang('yygq')end},
WIDGET.newButton{x=640,y=550,w=200,h=120,fText=langList.symbol,color='dH',font=35,code=function()_setLang('symbol')end},
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
}