代码拉取完成,页面将自动刷新
Component.onCompleted: {
if(!testSchemeModel()){
console.log("进入兼容报错窗口!")
loader.sourceComponent = anErroWindow
loader.item;
}else{
reBuildDB.checked = SettingsHelper.getBoolFromYaml("controlBehaviorOnScreen","reBuildDB")
reLoadPage();
}
}
function testSchemeModel(){
//先访问,发现错误,再插入
myUniversalYamlTool.vistAnyNodeForTest("engine:","translator:"," enable_user_dict:", false);
let test1= myUniversalYamlTool.getCurrentTargetLine();
console.log("检测 translator>enable_user_dict :"+test1)
if(test1.trim().length === 0){
console.log("添加: translator>enable_user_dict")
myUniversalYamlTool.appendAnyLineToCurrentList("schema","switches:","translator:"," enable_user_dict: false")
}
myUniversalYamlTool.vistAnyNodeForTest("engine:","translator:"," enable_sentence:", false);
let test2= myUniversalYamlTool.getCurrentTargetLine();
console.log("检测 translator>enable_sentence :"+test2)
if(test2.trim().length === 0){
console.log("添加: translator>enable_sentence")
myUniversalYamlTool.appendAnyLineToCurrentList("schema","switches:","translator:"," enable_sentence: false")
}
myUniversalYamlTool.vistAnyNodeForTest("engine:","translator:"," enable_completion:", false);
let test3= myUniversalYamlTool.getCurrentTargetLine();
console.log("检测 translator>enable_completion :"+test3)
if(test3.trim().length === 0){
console.log("添加: translator>enable_completion")
myUniversalYamlTool.appendAnyLineToCurrentList("schema","switches:","translator:"," enable_completion: false")
}
myUniversalYamlTool.vistAnyNodeForTest("engine:","translator:"," enable_encoder:", false);
let test4= myUniversalYamlTool.getCurrentTargetLine();
console.log("检测 translator>enable_encoder :"+test4)
if(test4.trim().length === 0){
console.log("添加: translator>enable_encoder")
myUniversalYamlTool.appendAnyLineToCurrentList("schema","switches:","translator:"," enable_encoder: false")
}
myUniversalYamlTool.vistAnyNodeForTest("engine:","translator:"," encode_commit_history:", false);
let test5= myUniversalYamlTool.getCurrentTargetLine();
console.log("检测 translator>encode_commit_history :"+test5)
if(test5.trim().length === 0){
console.log("添加: translator>encode_commit_history")
myUniversalYamlTool.appendAnyLineToCurrentList("schema","switches:","translator:"," encode_commit_history: false")
}
//防止模版错误
const ok1 = myUniversalYamlTool.testExistItem(" - name: transcription※ - name: emoji")
const ok2 = myUniversalYamlTool.testExistItem("menu:※ page_size:")
const ok3 = myUniversalYamlTool.testExistItem("melt_eng:※ - name: ascii_punct")
console.log("打印【薄荷】兼容性测试结果:"+ ok1 +","+ ok2 +","+ ok3)
return ok1 && ok2 && ok3
}
function reLoadPage(){
if(myUniversalYamlTool.testExistItem("accept: Return※send: Escape")){
// console.log("经验测,Return有值!")
cleanCodeByEnter.checked = true;
}else{
// console.log("经验测,Return无值!")
cleanCodeByEnter.checked = false
}
if(myUniversalYamlTool.testExistItem("accept: semicolon※send: 2")){
// console.log("经验测,Return有值!")
selectBysemicolon.checked = true;
}else{
// console.log("经验测,Return无值!")
selectBysemicolon.checked = false
}
myUniversalYamlTool.vistAnyNode("switches:"," - name: transcription"," reset:", true);
useTradition.checked = myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("switches:", " - name: ascii_mode", " reset:", true);
useAscii.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("switches:"," - name: emoji"," reset:", true);
showEmoji.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("switches:"," - name: ascii_punct"," reset:", true);
useENGPunc.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("switches:"," - name: full_shape"," reset:", true);
showFull_shape.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("engine:","translator:"," enable_user_dict:", true);
useAutoFre.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("engine:","translator:"," enable_sentence:", true);
useAutoPhrase.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("engine:","translator:"," enable_completion:", true);
useNextTips.checked = myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("switches:","menu:"," page_size:", true);
candidatesCount.value = myUniversalYamlTool.getCurrentListInt();
if(candidatesCount.value>9){//大于9,是非法的
candidatesCount.value = 9
}
else if(candidatesCount.value<=2){
candidatesCount.value = 2
}
console.log("捕获的 candidatesCount.value 是:"+candidatesCount.value)
getMainDictForCurrentSchemaID()
}
function getMainDictForCurrentSchemaID(){
myUniversalYamlTool.vistAnyNode("schema:","translator:"," dictionary:", true);
let nameFirst = myUniversalYamlTool.getCurrentListStr();
console.log("当前主翻译器的词典名称:"+nameFirst)
let nameSec = userDictRoot + "/"+ nameFirst + ".dict.yaml"
console.log("当前主词库名称:"+nameSec)
let nameLast = myUniversalYamlTool.vistAnyNodeByAnyYaml(nameSec,"name:", "import_tables:"," - dicts/", false)
nameLast = nameLast.replace(/\s*-\s*/, "");
console.log("捕获的是:"+ nameLast + ".dict.yaml")
let setStr = nameLast
setStr = setStr.replace(/[\/.]/g, '')
dBNameForCurrent = setStr
controlBehaviorOnScreen.currentMainDictFirst= nameLast + ".dict.yaml"
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。