越南语变音字母简化函数改为全unicode版本

限制自定义菜单背景选择范围
微调自定义背景设置ui
整理代码
This commit is contained in:
MrZ_26
2023-12-31 23:32:19 +08:00
parent 19ea76dc4c
commit 3a4fcf6d7b
16 changed files with 140 additions and 133 deletions

View File

@@ -17,8 +17,7 @@ local lastSearch -- Last searched string
local lastSelected -- Last selected item
local currentFontSize=25 -- Current font size, default: 25
local needLowerUTF8
local isLangVi -- There are special handlings that only for Vietnamese --SweetSea--
local utf8postProcess
local typeColor={
help=COLOR.Y,
@@ -45,11 +44,11 @@ local function _scanDict(D)
for i=1,#D do
local O=D[i]
O.title,O.title_Org=_filter(O[1])
O.titleLowered=needLowerUTF8 and STRING.lowerUTF8(O.title) or O.title:lower()
O.titleNoDiaratics=isLangVi and STRING.viRemoveDiacritics(O.titleLowered)
O.titleLowered=utf8postProcess and STRING.lowerUTF8(O.title) or O.title:lower()
O.titleNoDiaratics=utf8postProcess and STRING.remDiacritics(O.titleLowered)
O.keywords=O[2]
O.keywordsLowered=needLowerUTF8 and STRING.lowerUTF8(O.keywords) or O.keywords:lower()
O.keywordsNoDiaratics=isLangVi and STRING.viRemoveDiacritics(O.keywordsLowered)
O.keywordsLowered=utf8postProcess and STRING.lowerUTF8(O.keywords) or O.keywords:lower()
O.keywordsNoDiaratics=utf8postProcess and STRING.remDiacritics(O.keywordsLowered)
O.type=O[3]
O.content,O.content_Org=_filter(O[4])
O.url=O[5]
@@ -93,9 +92,9 @@ local function _search()
local pos
local first
_clearResult()
input=needLowerUTF8 and STRING.lowerUTF8(input) or input:lower()
input=utf8postProcess and STRING.lowerUTF8(input) or input:lower()
for i=1,#dict do
pos=find(dict[i].titleLowered,input,nil,true) or find(dict[i].keywordsLowered,input,nil,true) or isLangVi and (find(dict[i].titleNoDiaratics,input,nil,true) or find(dict[i].keywordsNoDiaratics,input,nil,true))
pos=find(dict[i].titleLowered,input,nil,true) or find(dict[i].keywordsLowered,input,nil,true) or utf8postProcess and (find(dict[i].titleNoDiaratics,input,nil,true) or find(dict[i].keywordsNoDiaratics,input,nil,true))
if pos==1 and not first then
ins(result,1,dict[i])
first=true
@@ -147,9 +146,8 @@ function scene.enter()
SETTING.locale:find'vi' and 'vi' or
'en'
)
needLowerUTF8=SETTING.locale:find'vi'
isLangVi=SETTING.locale:find'vi' -- DO NOT CHANGE THIS! --SweetSea--
utf8postProcess=SETTING.locale:find'vi'
dict=require(localeFile)
_scanDict(dict)