From 2c939fb84ba144648ada581ae676632d846498d5 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: Mon, 2 Sep 2024 09:01:28 +0800 Subject: [PATCH] lengthcheck --- .../LunaTranslator/LunaTranslator.py | 20 +++++++++++-------- .../gui/setting_display_text.py | 8 -------- .../LunaTranslator/gui/translatorUI.py | 14 +++---------- LunaTranslator/files/lang/ar.json | 2 -- LunaTranslator/files/lang/cht.json | 2 -- LunaTranslator/files/lang/cs.json | 2 -- LunaTranslator/files/lang/de.json | 2 -- LunaTranslator/files/lang/en.json | 2 -- LunaTranslator/files/lang/es.json | 2 -- LunaTranslator/files/lang/fr.json | 2 -- LunaTranslator/files/lang/it.json | 2 -- LunaTranslator/files/lang/ja.json | 2 -- LunaTranslator/files/lang/ko.json | 2 -- LunaTranslator/files/lang/nl.json | 2 -- LunaTranslator/files/lang/pl.json | 2 -- LunaTranslator/files/lang/pt.json | 2 -- LunaTranslator/files/lang/ru.json | 2 -- LunaTranslator/files/lang/sv.json | 2 -- LunaTranslator/files/lang/th.json | 2 -- LunaTranslator/files/lang/tr.json | 2 -- LunaTranslator/files/lang/uk.json | 2 -- LunaTranslator/files/lang/vi.json | 2 -- LunaTranslator/files/lang/zh.json | 1 - plugins/CMakeLists.txt | 2 +- 24 files changed, 16 insertions(+), 67 deletions(-) diff --git a/LunaTranslator/LunaTranslator/LunaTranslator.py b/LunaTranslator/LunaTranslator/LunaTranslator.py index 29f0be26..86f79892 100644 --- a/LunaTranslator/LunaTranslator/LunaTranslator.py +++ b/LunaTranslator/LunaTranslator/LunaTranslator.py @@ -284,10 +284,20 @@ class MAINUI: is_auto_run and ( text == self.currenttext - or len(text) - > (max(globalconfig["maxoriginlength"], globalconfig["maxlength"])) + or ( + len(text) < globalconfig["minlength"] + or len(text) > globalconfig["maxlength"] + ) ) ): + if text != "": + if len(text) > globalconfig["maxlength"]: + text = text[: globalconfig["maxlength"]] + "……" + else: + text = text + self.translation_ui.displayraw1.emit( + dict(text=text, color=globalconfig["rawtextcolor"]) + ) return safe_callback_none() try: @@ -329,12 +339,6 @@ class MAINUI: text_solved, optimization_params = self.solvebeforetrans(text) - if is_auto_run and ( - len(text_solved) < globalconfig["minlength"] - or len(text_solved) > globalconfig["maxlength"] - ): - return safe_callback_none() - premtalready = ["premt"] usefultranslators = list(self.translators.keys()) no_available_translator = True diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_text.py b/LunaTranslator/LunaTranslator/gui/setting_display_text.py index 40edaf24..15ab3aff 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_text.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_text.py @@ -471,14 +471,6 @@ def xianshigrid_style(self): globalconfig, "showatcenter" ), "", - "最长显示字数", - D_getspinbox( - 0, - 1000000, - globalconfig, - "maxoriginlength", - ), - "", "收到翻译时才刷新", D_getsimpleswitch( globalconfig, "refresh_on_get_trans" diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index e3cbea35..5868bcf0 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -317,15 +317,11 @@ class TranslatorWindow(resizableframeless): if onlytrans: return - if len(res) > globalconfig["maxoriginlength"]: - _res = res[: globalconfig["maxoriginlength"]] + "……" - else: - _res = res if globalconfig["showfanyisource"]: - _showtext = name + " " + _res + _showtext = name + " " + res else: - _showtext = _res + _showtext = res self.showline( clear=clear, text=_showtext, @@ -345,12 +341,8 @@ class TranslatorWindow(resizableframeless): clear = True if onlytrans: return - if len(text) > globalconfig["maxoriginlength"]: - _res = text[: globalconfig["maxoriginlength"]] + "……" - else: - _res = text if globalconfig["isshowrawtext"]: - self.showline(clear=clear, text=_res, isshowrawtext=True, color=color) + self.showline(clear=clear, text=text, isshowrawtext=True, color=color) else: self.showline(clear=clear) diff --git a/LunaTranslator/files/lang/ar.json b/LunaTranslator/files/lang/ar.json index 0b12c2e6..a5d3edef 100644 --- a/LunaTranslator/files/lang/ar.json +++ b/LunaTranslator/files/lang/ar.json @@ -515,7 +515,6 @@ "序列数": "رقم التسلسل", "过长惩罚": "عقوبة طويلة", "重复惩罚": "تكرار العقوبة", - "最长显示字数": "أقصى عرض الكلمات", "显示日语注音": "عرض صوتي ياباني", "注音颜色": "لون صوتي", "注音字体缩放": "حجم الخط", @@ -780,7 +779,6 @@ "捷克语": "اللغة التشيكية", "英语": "إنجليزي", "直接替换": "استبدال مباشر", - "占位符": "النائبة", "词典": "قواميس", "注释": "الحواشي", "打开链接": "فتح الرابط", diff --git a/LunaTranslator/files/lang/cht.json b/LunaTranslator/files/lang/cht.json index c96d9afa..258e93d2 100644 --- a/LunaTranslator/files/lang/cht.json +++ b/LunaTranslator/files/lang/cht.json @@ -515,7 +515,6 @@ "序列数": "序列數", "过长惩罚": "過長懲罰", "重复惩罚": "重複懲罰", - "最长显示字数": "最長顯示字數", "显示日语注音": "顯示日語注音", "注音颜色": "注音顏色", "注音字体缩放": "注音字體縮放", @@ -780,7 +779,6 @@ "捷克语": "捷克語", "英语": "英語", "直接替换": "直接取代", - "占位符": "預留位置", "词典": "詞典", "注释": "註釋", "打开链接": "打開連結", diff --git a/LunaTranslator/files/lang/cs.json b/LunaTranslator/files/lang/cs.json index b976b4a5..a271f17d 100644 --- a/LunaTranslator/files/lang/cs.json +++ b/LunaTranslator/files/lang/cs.json @@ -521,7 +521,6 @@ "过长惩罚": "Nadměrný trest", "重复惩罚": "Opakovaný trest", "语言包": "Jazykový balíček", - "最长显示字数": "Maximální počet zobrazených slov", "显示日语注音": "Zobrazit japonské fonetické anotace", "注音颜色": "Fonetická barva", "注音字体缩放": "Škálování fonetických písem", @@ -780,7 +779,6 @@ "英语": "angličtina", "捷克语": "Čeština", "直接替换": "Přímo nahradit", - "占位符": "zástupný symbol", "词典": "Slovník", "注释": "poznámky", "打开链接": "Otevřít odkaz", diff --git a/LunaTranslator/files/lang/de.json b/LunaTranslator/files/lang/de.json index e15df001..74d97203 100644 --- a/LunaTranslator/files/lang/de.json +++ b/LunaTranslator/files/lang/de.json @@ -521,7 +521,6 @@ "过长惩罚": "Übermäßige Bestrafung", "重复惩罚": "Wiederholte Strafe", "语言包": "Sprachpaket", - "最长显示字数": "Maximale Anzahl an angezeigten Wörtern", "显示日语注音": "Japanische phonetische Anmerkungen anzeigen", "注音颜色": "Phonetische Farbe", "注音字体缩放": "Skalierung der phonetischen Schriftarten", @@ -780,7 +779,6 @@ "捷克语": "Tschechisch", "英语": "Englisch", "直接替换": "Direkt ersetzen", - "占位符": "Platzhalter", "词典": "Wörterbuch", "注释": "Anmerkungen", "打开链接": "Link öffnen", diff --git a/LunaTranslator/files/lang/en.json b/LunaTranslator/files/lang/en.json index d50798f2..56f2ecc5 100644 --- a/LunaTranslator/files/lang/en.json +++ b/LunaTranslator/files/lang/en.json @@ -514,7 +514,6 @@ "序列数": "Sequence Number", "过长惩罚": "Length Penalty", "重复惩罚": "Repetition Penalty", - "最长显示字数": "Max Display Characters", "显示日语注音": "Show Furigana", "注音颜色": "Furigana Color", "注音字体缩放": "Furigana Font Scaling", @@ -780,7 +779,6 @@ "捷克语": "Czech", "英语": "English", "直接替换": "Directly replace", - "占位符": "placeholder ", "词典": "Dictionary", "注释": "notes", "打开链接": "Open link", diff --git a/LunaTranslator/files/lang/es.json b/LunaTranslator/files/lang/es.json index cb87c22e..30b2d984 100644 --- a/LunaTranslator/files/lang/es.json +++ b/LunaTranslator/files/lang/es.json @@ -515,7 +515,6 @@ "序列数": "Número de secuencias", "过长惩罚": "Castigo excesivo", "重复惩罚": "Repetir el castigo", - "最长显示字数": "Número máximo de palabras mostradas", "显示日语注音": "Muestra la fonética japonesa", "注音颜色": "Color de la nota", "注音字体缩放": "Escala de la fuente fonética", @@ -780,7 +779,6 @@ "捷克语": "Checo", "英语": "Inglés", "直接替换": "Sustitución directa", - "占位符": "Marcador de posición", "词典": "Diccionario", "注释": "Anotaciones", "打开链接": "Abrir enlace", diff --git a/LunaTranslator/files/lang/fr.json b/LunaTranslator/files/lang/fr.json index aff0e16d..0356a2ab 100644 --- a/LunaTranslator/files/lang/fr.json +++ b/LunaTranslator/files/lang/fr.json @@ -515,7 +515,6 @@ "序列数": "Nombre de séquences", "过长惩罚": "Pénalité trop longue", "重复惩罚": "Punition répétée", - "最长显示字数": "Nombre maximal de mots affichés", "显示日语注音": "Afficher les notes en japonais", "注音颜色": "Couleur d'accent", "注音字体缩放": "Zoom des polices d'accent", @@ -780,7 +779,6 @@ "捷克语": "Tchèque", "英语": "Anglais", "直接替换": "Remplacement direct", - "占位符": "Espace réservé", "词典": "Dictionnaire", "注释": "Notes", "打开链接": "Ouvrir le lien", diff --git a/LunaTranslator/files/lang/it.json b/LunaTranslator/files/lang/it.json index 76862740..a317363e 100644 --- a/LunaTranslator/files/lang/it.json +++ b/LunaTranslator/files/lang/it.json @@ -515,7 +515,6 @@ "序列数": "Numero di sequenze", "过长惩罚": "Pena eccessiva", "重复惩罚": "Pena ripetitiva", - "最长显示字数": "Numero massimo di parole visualizzate", "显示日语注音": "Mostra pinyin giapponese", "注音颜色": "Colore pinyin", "注音字体缩放": "Scalamento dei caratteri Bopomofo", @@ -780,7 +779,6 @@ "捷克语": "Ceco", "英语": "Inglese", "直接替换": "Sostituire direttamente", - "占位符": "segnaposto", "词典": "Dizionario", "注释": "note", "打开链接": "Apri link", diff --git a/LunaTranslator/files/lang/ja.json b/LunaTranslator/files/lang/ja.json index cca29b07..9582c4c8 100644 --- a/LunaTranslator/files/lang/ja.json +++ b/LunaTranslator/files/lang/ja.json @@ -515,7 +515,6 @@ "序列数": "シーケンス数", "过长惩罚": "長すぎる罰", "重复惩罚": "繰り返し罰する.", - "最长显示字数": "最長表示文字数", "显示日语注音": "日本語のルビを表示", "注音颜色": "ルビの色", "注音字体缩放": "ルビフォントの拡大・縮小", @@ -780,7 +779,6 @@ "捷克语": "チェコ語", "英语": "英語", "直接替换": "直接置換", - "占位符": "プレースホルダ", "词典": "辞書", "注释": "コメント", "打开链接": "リンクを開く", diff --git a/LunaTranslator/files/lang/ko.json b/LunaTranslator/files/lang/ko.json index 4cb3f885..ca3bfab4 100644 --- a/LunaTranslator/files/lang/ko.json +++ b/LunaTranslator/files/lang/ko.json @@ -515,7 +515,6 @@ "序列数": "시퀀스 수", "过长惩罚": "과도한 처벌", "重复惩罚": "반복 처벌", - "最长显示字数": "최대 표시 단어 수", "显示日语注音": "일본어 메모 표시", "注音颜色": "주음 색상", "注音字体缩放": "콜아웃 글꼴 크기 조절", @@ -780,7 +779,6 @@ "捷克语": "체코어", "英语": "영어", "直接替换": "직접 교체", - "占位符": "자리 표시자", "词典": "사전", "注释": "주석", "打开链接": "링크 열기", diff --git a/LunaTranslator/files/lang/nl.json b/LunaTranslator/files/lang/nl.json index d3ed9611..ae80fa63 100644 --- a/LunaTranslator/files/lang/nl.json +++ b/LunaTranslator/files/lang/nl.json @@ -521,7 +521,6 @@ "过长惩罚": "Overmatige straf", "重复惩罚": "Herhaalde straf", "语言包": "Taalpakket", - "最长显示字数": "Maximale hoeveelheid weergegeven woorden", "显示日语注音": "Japanse fonetische annotaties tonen", "注音颜色": "Fonetische kleur", "注音字体缩放": "Schaal van fonetische lettertypen", @@ -780,7 +779,6 @@ "捷克语": "Tsjechisch", "英语": "Engels", "直接替换": "Direct vervangen", - "占位符": "plaatsaanduiding", "词典": "Woordenboek", "注释": "notities", "打开链接": "Koppeling openen", diff --git a/LunaTranslator/files/lang/pl.json b/LunaTranslator/files/lang/pl.json index 2f8174fd..2f8fdf78 100644 --- a/LunaTranslator/files/lang/pl.json +++ b/LunaTranslator/files/lang/pl.json @@ -515,7 +515,6 @@ "序列数": "Liczba sekwencji", "过长惩罚": "Nadmierna kara", "重复惩罚": "Kary powtarzające się", - "最长显示字数": "Maksymalna liczba wyświetlanych słów", "显示日语注音": "Wyświetl japoński pinyin", "注音颜色": "Kolor pinyin", "注音字体缩放": "Skalowanie czcionki Bopomofo", @@ -780,7 +779,6 @@ "捷克语": "Czeski", "英语": "Angielski", "直接替换": "Bezpośrednio zastąpić", - "占位符": "symbol zastępczy", "词典": "Słownik", "注释": "notatki", "打开链接": "Otwórz link", diff --git a/LunaTranslator/files/lang/pt.json b/LunaTranslator/files/lang/pt.json index 361419ea..2e60754a 100644 --- a/LunaTranslator/files/lang/pt.json +++ b/LunaTranslator/files/lang/pt.json @@ -521,7 +521,6 @@ "过长惩罚": "Pena excessiva", "重复惩罚": "Repetição da punição", "语言包": "Pacote de Idiomas", - "最长显示字数": "Número máximo de palavras apresentadas", "显示日语注音": "Mostrar as anotações fonéticas japonesas", "注音颜色": "Cor fonética", "注音字体缩放": "Dimensionamento dos tipos de letra fonéticos", @@ -780,7 +779,6 @@ "英语": "Inglês", "捷克语": "Checo", "直接替换": "Substituir directamente", - "占位符": "espaço reservado", "词典": "Dicionário", "注释": "notas", "打开链接": "Abrir ligação", diff --git a/LunaTranslator/files/lang/ru.json b/LunaTranslator/files/lang/ru.json index f6605242..b70cb866 100644 --- a/LunaTranslator/files/lang/ru.json +++ b/LunaTranslator/files/lang/ru.json @@ -515,7 +515,6 @@ "序列数": "Количество последовательностей", "过长惩罚": "Слишком длительное наказание", "重复惩罚": "Повторное наказание", - "最长显示字数": "Максимальное количество слов", "显示日语注音": "Показать японское произношение", "注音颜色": "Цвет звука", "注音字体缩放": "Масштаб шрифта", @@ -780,7 +779,6 @@ "捷克语": "Чешский язык", "英语": "Английский язык", "直接替换": "Прямая замена", - "占位符": "Заполнитель", "词典": "Словарь", "注释": "Примечания", "打开链接": "Открыть ссылку", diff --git a/LunaTranslator/files/lang/sv.json b/LunaTranslator/files/lang/sv.json index 166710c3..c5ff5a07 100644 --- a/LunaTranslator/files/lang/sv.json +++ b/LunaTranslator/files/lang/sv.json @@ -521,7 +521,6 @@ "过长惩罚": "Överdrivet straff", "重复惩罚": "Upprepat straff", "语言包": "Språkpaket", - "最长显示字数": "Maximalt antal visade ord", "显示日语注音": "Visa japanska fonetiska anteckningar", "注音颜色": "Fonetisk färg", "注音字体缩放": "Skalning av fonetiska teckensnitt", @@ -780,7 +779,6 @@ "捷克语": "Tjeckiska", "英语": "Engelska", "直接替换": "Byt direkt ut", - "占位符": "platshållare", "词典": "Ordbok", "注释": "anteckningar", "打开链接": "Öppna länk", diff --git a/LunaTranslator/files/lang/th.json b/LunaTranslator/files/lang/th.json index 9eef4af4..7dd9b6d0 100644 --- a/LunaTranslator/files/lang/th.json +++ b/LunaTranslator/files/lang/th.json @@ -515,7 +515,6 @@ "序列数": "จำนวนลำดับ", "过长惩罚": "การลงโทษที่ยาวนานเกินไป", "重复惩罚": "การลงโทษซ้ำ", - "最长显示字数": "แสดงจำนวนคำที่ยาวที่สุด", "显示日语注音": "แสดงหมายเหตุภาษาญี่ปุ่น", "注音颜色": "สี Injection", "注音字体缩放": "Note ตัวอักษร Zoom", @@ -780,7 +779,6 @@ "捷克语": "เช็ก", "英语": "ภาษาอังกฤษ", "直接替换": "แทนที่โดยตรง", - "占位符": "ตัวยึดตำแหน่ง", "词典": "พจนานุกรม", "注释": "หมายเหตุ", "打开链接": "เปิดลิงค์", diff --git a/LunaTranslator/files/lang/tr.json b/LunaTranslator/files/lang/tr.json index 457697b8..589c40d4 100644 --- a/LunaTranslator/files/lang/tr.json +++ b/LunaTranslator/files/lang/tr.json @@ -515,7 +515,6 @@ "序列数": "Sezenler sayısı", "过长惩罚": "Çok fazla ceza", "重复惩罚": "Tekrar cezalandırıcı", - "最长显示字数": "Gösterilen sözlerin en yüksek sayısı", "显示日语注音": "Display Japanese Pinyin", "注音颜色": "Pinyin rengi", "注音字体缩放": "Bopomofo yazıtipi skalaması", @@ -780,7 +779,6 @@ "捷克语": "Çehçe", "英语": "İngilizce", "直接替换": "Direkten değiştir", - "占位符": "yer sahibi", "词典": "Sözlük", "注释": "notlar", "打开链接": "Bağlantı Aç", diff --git a/LunaTranslator/files/lang/uk.json b/LunaTranslator/files/lang/uk.json index f6e32645..48481730 100644 --- a/LunaTranslator/files/lang/uk.json +++ b/LunaTranslator/files/lang/uk.json @@ -515,7 +515,6 @@ "序列数": "Кількість послідовностей", "过长惩罚": "Великий покарання", "重复惩罚": "Повторює покарання", - "最长显示字数": "Максимальна кількість показаних слів", "显示日语注音": "Показувати японський пінін", "注音颜色": "Колір пініна", "注音字体缩放": "Масштабування шрифтів Bopomofo", @@ -780,7 +779,6 @@ "捷克语": "Чешка", "英语": "Англійська@ item Spelling dictionary", "直接替换": "Прямо замінити", - "占位符": "замінник", "词典": "Словник", "注释": "нотатки", "打开链接": "Відкрити посилання", diff --git a/LunaTranslator/files/lang/vi.json b/LunaTranslator/files/lang/vi.json index f04a037c..eaea731a 100644 --- a/LunaTranslator/files/lang/vi.json +++ b/LunaTranslator/files/lang/vi.json @@ -515,7 +515,6 @@ "序列数": "Số dãy", "过长惩罚": "Hình phạt quá dài", "重复惩罚": "Hình phạt lặp lại", - "最长显示字数": "Hiển thị tối đa số từ", "显示日语注音": "Hiện chú thích tiếng Nhật", "注音颜色": "Màu chú thích", "注音字体缩放": "Thu phóng phông chữ chú thích", @@ -780,7 +779,6 @@ "捷克语": "Tiếng Séc", "英语": "Tiếng Việt", "直接替换": "Thay thế trực tiếp", - "占位符": "Bộ giữ chỗ", "词典": "Từ điển", "注释": "Ghi chú", "打开链接": "Mở liên kết", diff --git a/LunaTranslator/files/lang/zh.json b/LunaTranslator/files/lang/zh.json index cd4ac77a..e99dc17f 100644 --- a/LunaTranslator/files/lang/zh.json +++ b/LunaTranslator/files/lang/zh.json @@ -521,7 +521,6 @@ "过长惩罚": "", "重复惩罚": "", "语言包": "", - "最长显示字数": "", "显示日语注音": "", "注音颜色": "", "注音字体缩放": "", diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 9cba6765..9248a284 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ include(generate_product_version) set(VERSION_MAJOR 5) set(VERSION_MINOR 33) -set(VERSION_PATCH 0) +set(VERSION_PATCH 1) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)