From d8ec8793faec0dc61e42bd4616e3179889a376e5 Mon Sep 17 00:00:00 2001 From: sgmklp <2394501736@qq.com> Date: Mon, 17 Oct 2022 02:03:45 +0800 Subject: [PATCH] keep the old match function avaliable --- javascript/tagAutocomplete.js | 22 +++++++++++++++------- tags/config.json | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/javascript/tagAutocomplete.js b/javascript/tagAutocomplete.js index 075796b..936ab58 100644 --- a/javascript/tagAutocomplete.js +++ b/javascript/tagAutocomplete.js @@ -523,15 +523,23 @@ onUiUpdate(function () { if (acConfig.translation.extraTranslationFile) { try { allTranslations = loadCSV(`file/tags/${acConfig.translation.extraTranslationFile}`); - allTranslations.map(x => { - if (x[2]) { - for (let i = 0; i < allTags.length; i++) { - if (x[0] === allTags[i][0] && x[1] === allTags[i][1]) { - allTags[i][2] = x[2]; - } + if (acConfig.simpleExtraTranslationFile) { + for (let i = 0; i < allTranslations.length; i++) { + if (allTranslations[i][0]) { + allTags[i][2] = allTranslations[i][0]; } } - }); + } else { + allTranslations.map(x => { + if (x[2]) { + for (let i = 0; i < allTags.length; i++) { + if (x[0] === allTags[i][0] && x[1] === allTags[i][1]) { + allTags[i][2] = x[2]; + } + } + } + }); + } } catch (e) { console.error("Error loading extra translation file: " + e); return; diff --git a/tags/config.json b/tags/config.json index 5cdf536..8a56dd6 100644 --- a/tags/config.json +++ b/tags/config.json @@ -14,6 +14,7 @@ "translation": { "searchByTranslation": true, "onlyShowTranslation": false, + "simpleExtraTranslationFile": false, "extraTranslationFile": "" }, "colors": {