From a547ef7f5c03d4750a9a2aafb409181d70af51c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:48:16 +0800 Subject: [PATCH] . --- src/LunaTranslator/gui/setting_translate.py | 7 ++----- src/LunaTranslator/translator/premt.py | 2 +- src/LunaTranslator/translator/rengong.py | 12 ++++-------- src/files/defaultconfig/config.json | 4 +--- src/files/lang/ar.json | 1 - src/files/lang/cht.json | 1 - src/files/lang/cs.json | 1 - src/files/lang/de.json | 1 - src/files/lang/en.json | 1 - src/files/lang/es.json | 1 - src/files/lang/fr.json | 1 - src/files/lang/it.json | 1 - src/files/lang/ja.json | 1 - src/files/lang/ko.json | 1 - src/files/lang/nl.json | 1 - src/files/lang/pl.json | 1 - src/files/lang/pt.json | 1 - src/files/lang/ru.json | 1 - src/files/lang/sv.json | 1 - src/files/lang/th.json | 1 - src/files/lang/tr.json | 1 - src/files/lang/uk.json | 1 - src/files/lang/vi.json | 1 - src/files/lang/zh.json | 1 - 24 files changed, 8 insertions(+), 37 deletions(-) diff --git a/src/LunaTranslator/gui/setting_translate.py b/src/LunaTranslator/gui/setting_translate.py index 25dc782e..65ae87bd 100644 --- a/src/LunaTranslator/gui/setting_translate.py +++ b/src/LunaTranslator/gui/setting_translate.py @@ -485,14 +485,11 @@ def setTabTwo_lazy(self, basel): type="grid", grid=( [ - "模糊匹配", - D_getsimpleswitch(globalconfig, "premtsimiuse"), - "", "模糊匹配_相似度_%", D_getspinbox(0, 100, globalconfig, "premtsimi2"), "", - "逐行匹配", - D_getsimpleswitch(globalconfig, "premtmatcheveryline"), + "", + "", ], [ (functools.partial(createbtnexport, self), 0), diff --git a/src/LunaTranslator/translator/premt.py b/src/LunaTranslator/translator/premt.py index df43032e..d6b364d8 100644 --- a/src/LunaTranslator/translator/premt.py +++ b/src/LunaTranslator/translator/premt.py @@ -49,7 +49,7 @@ class TS(basetrans): return {} else: sql = self.sql - if globalconfig["premtsimiuse"]: + if globalconfig["premtsimi2"] < 100: maxsim = 0 savet = "{}" ret = sql.execute("SELECT * FROM artificialtrans ").fetchall() diff --git a/src/LunaTranslator/translator/rengong.py b/src/LunaTranslator/translator/rengong.py index 7dfe2e73..85084963 100644 --- a/src/LunaTranslator/translator/rengong.py +++ b/src/LunaTranslator/translator/rengong.py @@ -79,7 +79,7 @@ class TS(basetrans): self.lines[ks[i]] = vs[i] def tryfindtranslate(self, content: str, _js: dict, _js2: dict = None): - if globalconfig["premtsimiuse"]: + if globalconfig["premtsimi2"] < 100: maxsim = 0 savet = None @@ -103,11 +103,8 @@ class TS(basetrans): def tryfindtranslate_single(self, content: str): self.delayloadlines() - if "\n" not in content: - return self.tryfindtranslate(content, self.json, self.lines) - collect = [] - for line in content.split("\n"): + for line in content.splitlines(): line = self.tryfindtranslate(line, self.json, self.lines) if not line: return None @@ -120,10 +117,9 @@ class TS(basetrans): self.checkfilechanged( self.unsafegetcurrentgameconfig(), tuple(self.config["jsonfile"]) ) - if globalconfig["premtmatcheveryline"]: + res = self.tryfindtranslate(content, self.json) + if (not res) and ("\n" in content): res = self.tryfindtranslate_single(content) - else: - res = self.tryfindtranslate(content, self.json) if not res: raise Exception(f"can't find: {content}") return res diff --git a/src/files/defaultconfig/config.json b/src/files/defaultconfig/config.json index 41048908..8c20318d 100644 --- a/src/files/defaultconfig/config.json +++ b/src/files/defaultconfig/config.json @@ -510,13 +510,11 @@ "accept_use_unicode": false, "accept_use_unicode_start": 0, "accept_use_unicode_end": 65535, - "premtsimiuse": false, - "premtmatcheveryline": false, "buttoncolor": "#2e2eff", "buttoncolor2": "#FF69B4", "buttoncolor3": "#afafaf", "buttoncolor_1": "#ff03f2", - "premtsimi2": 100, + "premtsimi2": 90, "ocrrangecolor": "#000000", "ocrrangewidth": 2, "useproxy": true, diff --git a/src/files/lang/ar.json b/src/files/lang/ar.json index 462d08bc..d35303eb 100644 --- a/src/files/lang/ar.json +++ b/src/files/lang/ar.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "إظهار / إخفاء الترجمة", "不显示翻译器名称": "لا يتم عرض اسم المترجم", "华为云": "هوا وي يون", - "逐行匹配": "خط مطابقة", "游戏适配": "لعبة مباراة", "指定翻译器": "تعيين مترجم", "关于软件": "عن البرمجيات", diff --git a/src/files/lang/cht.json b/src/files/lang/cht.json index 1927db61..937642ef 100644 --- a/src/files/lang/cht.json +++ b/src/files/lang/cht.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "顯示/隱藏翻譯", "不显示翻译器名称": "不顯示翻譯器名稱", "华为云": "華為雲", - "逐行匹配": "逐行匹配", "游戏适配": "遊戲適配", "指定翻译器": "指定翻譯器", "关于软件": "關於軟體", diff --git a/src/files/lang/cs.json b/src/files/lang/cs.json index 96560554..911c24fb 100644 --- a/src/files/lang/cs.json +++ b/src/files/lang/cs.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Zobrazit/skrýt překlad", "不显示翻译器名称": "Nezobrazovat jméno překladatele", "华为云": "Hua Weiyun.", - "逐行匹配": "Shoda řádku po řádku", "游戏适配": "Úprava hry", "指定翻译器": "Upřesnit překladatele", "关于软件": "O softwaru", diff --git a/src/files/lang/de.json b/src/files/lang/de.json index d639b086..20a64df3 100644 --- a/src/files/lang/de.json +++ b/src/files/lang/de.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Übersetzung ein-/ausblenden", "不显示翻译器名称": "Übersetzername nicht anzeigen", "华为云": "Hua Weiyun", - "逐行匹配": "Zeile für Zeile übereinstimmen", "游戏适配": "Anpassung des Spiels", "指定翻译器": "Übersetzer angeben", "关于软件": "Über Software", diff --git a/src/files/lang/en.json b/src/files/lang/en.json index c3b5e3bc..799ebfcd 100644 --- a/src/files/lang/en.json +++ b/src/files/lang/en.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Show/Hide Translation", "不显示翻译器名称": "Do not display translator name", "华为云": "Hua Weiyun", - "逐行匹配": "Match line by line", "游戏适配": "Game adaptation", "指定翻译器": "Specify translator", "关于软件": "About software", diff --git a/src/files/lang/es.json b/src/files/lang/es.json index 1201e175..b1e63d5c 100644 --- a/src/files/lang/es.json +++ b/src/files/lang/es.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Mostrar / ocultar traducción", "不显示翻译器名称": "No se muestra el nombre del traductor", "华为云": "Hua weiyun", - "逐行匹配": "Coincidencia línea a línea", "游戏适配": "Adaptación del juego", "指定翻译器": "Especificar traductor", "关于软件": "Sobre el software", diff --git a/src/files/lang/fr.json b/src/files/lang/fr.json index 375377bb..ad62c8a9 100644 --- a/src/files/lang/fr.json +++ b/src/files/lang/fr.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Afficher / masquer la traduction", "不显示翻译器名称": "Ne pas afficher le nom du traducteur", "华为云": "Huawei Cloud", - "逐行匹配": "Correspondance ligne par ligne", "游戏适配": "Adaptation du jeu", "指定翻译器": "Spécifier le traducteur", "关于软件": "À propos du logiciel", diff --git a/src/files/lang/it.json b/src/files/lang/it.json index a6c73262..8aaf07ba 100644 --- a/src/files/lang/it.json +++ b/src/files/lang/it.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Mostra/Nascondi traduzione", "不显示翻译器名称": "Non visualizzare il nome del traduttore", "华为云": "Hua Weiyun", - "逐行匹配": "Corrisponda linea per linea", "游戏适配": "Adattamento del gioco", "指定翻译器": "Specifica traduttore", "关于软件": "Informazioni sul software", diff --git a/src/files/lang/ja.json b/src/files/lang/ja.json index e6011da8..e26ae6f9 100644 --- a/src/files/lang/ja.json +++ b/src/files/lang/ja.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "翻訳の表示/非表示", "不显示翻译器名称": "翻訳者名を表示しない", "华为云": "華を雲と為す", - "逐行匹配": "プログレッシブマッチング", "游戏适配": "ゲームアダプタ", "指定翻译器": "翻訳機の指定", "关于软件": "ソフトウェアについて", diff --git a/src/files/lang/ko.json b/src/files/lang/ko.json index 44109109..a2b75517 100644 --- a/src/files/lang/ko.json +++ b/src/files/lang/ko.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "번역 표시 / 숨기기", "不显示翻译器名称": "번역기 이름이 표시되지 않음", "华为云": "화위운", - "逐行匹配": "행별 일치", "游戏适配": "게임 적합성", "指定翻译器": "번역기 지정", "关于软件": "소프트웨어 정보", diff --git a/src/files/lang/nl.json b/src/files/lang/nl.json index f89cfab5..e4334636 100644 --- a/src/files/lang/nl.json +++ b/src/files/lang/nl.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Vertaling tonen/verbergen", "不显示翻译器名称": "Toon de naam van de vertaler niet", "华为云": "Hua Weiyun.", - "逐行匹配": "Lijn voor regel overeenkomen", "游戏适配": "Game aanpassing", "指定翻译器": "Vertaler opgeven", "关于软件": "Over software", diff --git a/src/files/lang/pl.json b/src/files/lang/pl.json index 5d7d3d3f..3b6fe6c0 100644 --- a/src/files/lang/pl.json +++ b/src/files/lang/pl.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Pokaż/ukryj tłumaczenie", "不显示翻译器名称": "Nie wyświetlaj nazwy tłumacza", "华为云": "Hua Weiyun.", - "逐行匹配": "Dopasuj linię po linii", "游戏适配": "Adaptacja gry", "指定翻译器": "Określ tłumacza", "关于软件": "O oprogramowaniu", diff --git a/src/files/lang/pt.json b/src/files/lang/pt.json index 686aa6f2..88b82f81 100644 --- a/src/files/lang/pt.json +++ b/src/files/lang/pt.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Mostrar/ Esconder a Tradução", "不显示翻译器名称": "Não mostrar o nome do tradutor", "华为云": "Hua Weiyun", - "逐行匹配": "Corresponder linha por linha", "游戏适配": "Adaptação do jogo", "指定翻译器": "Especificar o tradutor", "关于软件": "Sobre o software", diff --git a/src/files/lang/ru.json b/src/files/lang/ru.json index 9e6b9b54..074dc0d3 100644 --- a/src/files/lang/ru.json +++ b/src/files/lang/ru.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Показать / скрыть перевод", "不显示翻译器名称": "Не показывать имя переводчика", "华为云": "Хуа как облако", - "逐行匹配": "Постепенное согласование", "游戏适配": "Игра подходит", "指定翻译器": "Назначить переводчика", "关于软件": "О программном обеспечении", diff --git a/src/files/lang/sv.json b/src/files/lang/sv.json index 7f9696e7..696497c6 100644 --- a/src/files/lang/sv.json +++ b/src/files/lang/sv.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Visa/dölj översättning", "不显示翻译器名称": "Visa inte översättarens namn", "华为云": "Hua Weiyun", - "逐行匹配": "Matcha rad för rad", "游戏适配": "Spelanpassning", "指定翻译器": "Ange översättare", "关于软件": "Om programvara", diff --git a/src/files/lang/th.json b/src/files/lang/th.json index 0e31bf28..f4e7ddcc 100644 --- a/src/files/lang/th.json +++ b/src/files/lang/th.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "แสดง/ซ่อนการแปล", "不显示翻译器名称": "ไม่แสดงชื่อแปล", "华为云": "Huawei เมฆ", - "逐行匹配": "จับคู่ตามบรรทัด", "游戏适配": "การปรับเกม", "指定翻译器": "ระบุนักแปล", "关于软件": "เกี่ยวกับซอฟต์แวร์", diff --git a/src/files/lang/tr.json b/src/files/lang/tr.json index bc47eabf..01c3d92f 100644 --- a/src/files/lang/tr.json +++ b/src/files/lang/tr.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Çeviri Göster/Gizle", "不显示翻译器名称": "Tercüme ismini gösterme", "华为云": "Hua Weiyun", - "逐行匹配": "Satırla eşleştir", "游戏适配": "Oyun uygulaması", "指定翻译器": "Çevirmeyi belirtin", "关于软件": "Yazılım hakkında", diff --git a/src/files/lang/uk.json b/src/files/lang/uk.json index 90b8b0e3..cb51664d 100644 --- a/src/files/lang/uk.json +++ b/src/files/lang/uk.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Показувати/сховати переклад", "不显示翻译器名称": "Не показувати назву перекладача", "华为云": "Hua Weiyun", - "逐行匹配": "Порівнювати рядок за рядком", "游戏适配": "Адаптація гри", "指定翻译器": "Вкажіть перекладач", "关于软件": "Про програмне забезпечення", diff --git a/src/files/lang/vi.json b/src/files/lang/vi.json index e7a19b5c..b0f0b069 100644 --- a/src/files/lang/vi.json +++ b/src/files/lang/vi.json @@ -788,7 +788,6 @@ "显示/隐藏翻译": "Hiện/ẩn bản dịch", "不显示翻译器名称": "Name", "华为云": "Hoa Vi Vân", - "逐行匹配": "Khớp từng dòng", "游戏适配": "Trò chơi phù hợp", "指定翻译器": "Chỉ định trình dịch", "关于软件": "Về phần mềm", diff --git a/src/files/lang/zh.json b/src/files/lang/zh.json index 05af9e48..f41c4817 100644 --- a/src/files/lang/zh.json +++ b/src/files/lang/zh.json @@ -789,7 +789,6 @@ "还原图标": "", "拉丁语": "", "华为云": "", - "逐行匹配": "", "指定翻译器": "", "关于软件": "", "严格的": "",