暂时不使用越南语词典,等待翻译更新
This commit is contained in:
@@ -102,17 +102,19 @@ local function _clearResult()
|
|||||||
end
|
end
|
||||||
-- Search through the dictionary
|
-- Search through the dictionary
|
||||||
local function _search()
|
local function _search()
|
||||||
|
local _utf8lower=SETTING.locale:find'vi'
|
||||||
local input=inputBox:getText()
|
local input=inputBox:getText()
|
||||||
local pos
|
local pos
|
||||||
_clearResult()
|
_clearResult()
|
||||||
local first
|
local first
|
||||||
if dict=='vi' then
|
if _utf8lower then
|
||||||
local success,input=pcall(function() STRING.lowerUTF8(input) end)
|
local success,res=pcall(STRING.lowerUTF8,input)
|
||||||
if not success then input=input:lower() end
|
input=success and res or input:lower()
|
||||||
else
|
else
|
||||||
input=input:lower() end
|
input=input:lower()
|
||||||
|
end
|
||||||
for i=1,#dict do
|
for i=1,#dict do
|
||||||
if dict=='vi' then
|
if _utf8lower then
|
||||||
pos=find(STRING.lowerUTF8(dict[i].title),input,nil,true) or find(STRING.lowerUTF8(dict[i].keywords),input,nil,true)
|
pos=find(STRING.lowerUTF8(dict[i].title),input,nil,true) or find(STRING.lowerUTF8(dict[i].keywords),input,nil,true)
|
||||||
else
|
else
|
||||||
pos=find(dict[i].title:lower(),input,nil,true) or find(dict[i].keywords:lower(),input,nil,true)
|
pos=find(dict[i].title:lower(),input,nil,true) or find(dict[i].keywords:lower(),input,nil,true)
|
||||||
@@ -163,7 +165,12 @@ end
|
|||||||
|
|
||||||
-- Reset everything when opening Zictionary
|
-- Reset everything when opening Zictionary
|
||||||
function scene.enter()
|
function scene.enter()
|
||||||
localeFile='parts.language.dict_'..(SETTING.locale:find'zh' and 'zh' or SETTING.locale:find'ja' and 'ja' or SETTING.locale:find'vi' and 'vi' or 'en')
|
localeFile='parts.language.dict_'..(
|
||||||
|
SETTING.locale:find'zh' and 'zh' or
|
||||||
|
SETTING.locale:find'ja' and 'ja' or
|
||||||
|
-- SETTING.locale:find'vi' and 'vi' or
|
||||||
|
'en'
|
||||||
|
)
|
||||||
dict=require(localeFile)
|
dict=require(localeFile)
|
||||||
_scanDict(dict)
|
_scanDict(dict)
|
||||||
|
|
||||||
@@ -193,19 +200,15 @@ function scene.keyDown(key)
|
|||||||
-- Switching selected items
|
-- Switching selected items
|
||||||
if key=='up' or key=='down' then
|
if key=='up' or key=='down' then
|
||||||
textBox:scroll(key=='up' and -1 or 1)
|
textBox:scroll(key=='up' and -1 or 1)
|
||||||
|
|
||||||
elseif (key=='left' or key=='pageup' or key=='right' or key=='pagedown') then
|
elseif (key=='left' or key=='pageup' or key=='right' or key=='pagedown') then
|
||||||
_jumpover(key,love.keyboard.isDown('lctrl','rctrl','lalt','ralt','lshift','rshift') and 12)
|
_jumpover(key,love.keyboard.isDown('lctrl','rctrl','lalt','ralt','lshift','rshift') and 12)
|
||||||
|
|
||||||
elseif key=='cC' or key=='c' and love.keyboard.isDown('lctrl','rctrl') then
|
elseif key=='cC' or key=='c' and love.keyboard.isDown('lctrl','rctrl') then
|
||||||
if listBox.selected>0 then
|
if listBox.selected>0 then
|
||||||
_copy()
|
_copy()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif (key=='-' or key=='=' or key=='0') and (inputBox:getText()=="" or not inputBoxFocus) and not MOBILE then
|
elseif (key=='-' or key=='=' or key=='0') and (inputBox:getText()=="" or not inputBoxFocus) and not MOBILE then
|
||||||
WIDGET.unFocus(true)
|
WIDGET.unFocus(true)
|
||||||
_setZoom(key=='0' and 0 or key=='-' and -5 or 5)
|
_setZoom(key=='0' and 0 or key=='-' and -5 or 5)
|
||||||
|
|
||||||
elseif key=='application' and listBox.selected>=0 then
|
elseif key=='application' and listBox.selected>=0 then
|
||||||
local url=_getList()[listBox.selected].url
|
local url=_getList()[listBox.selected].url
|
||||||
if url then love.system.openURL(url) end
|
if url then love.system.openURL(url) end
|
||||||
@@ -340,7 +343,7 @@ scene.widgetList={
|
|||||||
WIDGET.newKey{name='help',x=1234,y=220,w=60,font=40,fText=CHAR.icon.help,code=pressKey'f1'},
|
WIDGET.newKey{name='help',x=1234,y=220,w=60,font=40,fText=CHAR.icon.help,code=pressKey'f1'},
|
||||||
|
|
||||||
WIDGET.newButton{name='back',x=1185,y=60,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
|
WIDGET.newButton{name='back',x=1185,y=60,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
|
||||||
WIDGET.newText {name='buttontip',x=1274,y=110,w=762,h=60,font=40,align='R',fText=CHAR.controller.xboxY.."/[F1]: "..CHAR.icon.help}
|
WIDGET.newText{name='buttontip',x=1274,y=110,w=762,h=60,font=40,align='R',fText=CHAR.controller.xboxY.."/[F1]: "..CHAR.icon.help},
|
||||||
}
|
}
|
||||||
-- NOTE: The gap between Link-Copy, Zoom is 60*1.5-10=80 :) The gap between 2 buttons in one group is 60+10=70
|
-- NOTE: The gap between Link-Copy, Zoom is 60*1.5-10=80 :) The gap between 2 buttons in one group is 60+10=70
|
||||||
return scene
|
return scene
|
||||||
Reference in New Issue
Block a user