diff --git a/LunaTranslator/LunaTranslator/gui/setting_textinput.py b/LunaTranslator/LunaTranslator/gui/setting_textinput.py index ed7d164e..2ba13a17 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_textinput.py +++ b/LunaTranslator/LunaTranslator/gui/setting_textinput.py @@ -363,6 +363,21 @@ def gethookembedgrid(self): callback=lambda _: gobject.baseobject.textsource.flashembedsettings(), ), ], + [ + "限制每行字数", + D_getsimpleswitch( + globalconfig["embedded"], + "limittextlength_use", + callback=lambda _: gobject.baseobject.textsource.flashembedsettings(), + ), + D_getspinbox( + 0, + 1000, + globalconfig["embedded"], + "limittextlength_length", + callback=lambda x: gobject.baseobject.textsource.flashembedsettings(), + ), + ], [ "修改游戏字体", D_getsimpleswitch( diff --git a/LunaTranslator/LunaTranslator/textsource/texthook.py b/LunaTranslator/LunaTranslator/textsource/texthook.py index c8cbd813..3939f76c 100644 --- a/LunaTranslator/LunaTranslator/textsource/texthook.py +++ b/LunaTranslator/LunaTranslator/textsource/texthook.py @@ -209,6 +209,7 @@ class texthook(basetext): c_uint32, c_uint32, c_bool, + c_uint32, ) self.Luna_checkisusingembed = LunaHost.Luna_checkisusingembed self.Luna_checkisusingembed.argtypes = DWORD, c_uint64, c_uint64, c_uint64 @@ -349,6 +350,11 @@ class texthook(basetext): globalconfig["embedded"]["insertspace_policy"], globalconfig["embedded"]["keeprawtext"], True, + ( + globalconfig["embedded"]["limittextlength_length"] + if globalconfig["embedded"]["limittextlength_use"] + else 0 + ), ) def onremovehook(self, hc, hn, tp): diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json index b75c5c52..216eb133 100644 --- a/LunaTranslator/files/defaultconfig/config.json +++ b/LunaTranslator/files/defaultconfig/config.json @@ -321,7 +321,9 @@ "changefont": false, "changefont_font": "", "changecharset": false, - "changecharset_charset": 2 + "changecharset_charset": 2, + "limittextlength_use": false, + "limittextlength_length": 40 }, "requestinterval": 1, "keepontop": true, diff --git a/LunaTranslator/files/lang/ar.json b/LunaTranslator/files/lang/ar.json index 6f4ec454..997b19e6 100644 --- a/LunaTranslator/files/lang/ar.json +++ b/LunaTranslator/files/lang/ar.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "حدد صف مع نسخة MD5 الحالي", "修改列表名称": "تعديل اسم القائمة", "滚动到最后": "انتقل إلى آخر", - "创建列表": "إنشاء قائمة" + "创建列表": "إنشاء قائمة", + "限制每行字数": "الحد من عدد الكلمات في السطر" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/cht.json b/LunaTranslator/files/lang/cht.json index 3e1aec99..9e4c8a2b 100644 --- a/LunaTranslator/files/lang/cht.json +++ b/LunaTranslator/files/lang/cht.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "以當前md5複製選中行", "修改列表名称": "修改清單名稱", "滚动到最后": "滾動到最後", - "创建列表": "創建清單" + "创建列表": "創建清單", + "限制每行字数": "限制每行字數" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/en.json b/LunaTranslator/files/lang/en.json index 9c3fb0e3..106c2b0a 100644 --- a/LunaTranslator/files/lang/en.json +++ b/LunaTranslator/files/lang/en.json @@ -810,5 +810,6 @@ "修改列表名称": "Modify List Name", "滚动到最后": "Scroll to End", "指定模块": "Specify modules", - "创建列表": "Create List" + "创建列表": "Create List", + "限制每行字数": "Limit the number of words per line" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/es.json b/LunaTranslator/files/lang/es.json index 6fe93483..49d91713 100644 --- a/LunaTranslator/files/lang/es.json +++ b/LunaTranslator/files/lang/es.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "Copiar la línea seleccionada con el MD5 actual", "修改列表名称": "Modificar el nombre de la lista", "滚动到最后": "Rodar hasta el final", - "创建列表": "Crear lista" + "创建列表": "Crear lista", + "限制每行字数": "Limitar el número de palabras por línea" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/fr.json b/LunaTranslator/files/lang/fr.json index c4583446..bb9c4e7d 100644 --- a/LunaTranslator/files/lang/fr.json +++ b/LunaTranslator/files/lang/fr.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "Copier la ligne sélectionnée avec le MD5 actuel", "修改列表名称": "Modifier le nom de la Liste", "滚动到最后": "Rouler jusqu'à la fin", - "创建列表": "Créer une liste" + "创建列表": "Créer une liste", + "限制每行字数": "Limiter le nombre de mots par ligne" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/it.json b/LunaTranslator/files/lang/it.json index dc5b427a..522d3475 100644 --- a/LunaTranslator/files/lang/it.json +++ b/LunaTranslator/files/lang/it.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "Copia la riga selezionata con l'MD5 corrente", "修改列表名称": "Modifica nome elenco", "滚动到最后": "Scorri fino alla fine", - "创建列表": "Crea elenco" + "创建列表": "Crea elenco", + "限制每行字数": "Limitare il numero di parole per riga" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ja.json b/LunaTranslator/files/lang/ja.json index c0910bcd..e86e0376 100644 --- a/LunaTranslator/files/lang/ja.json +++ b/LunaTranslator/files/lang/ja.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "選択した行を現在のmd 5でコピー", "修改列表名称": "リスト名の変更", "滚动到最后": "最後までスクロール", - "创建列表": "リストの作成" + "创建列表": "リストの作成", + "限制每行字数": "1行あたりの文字数を制限する" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ko.json b/LunaTranslator/files/lang/ko.json index 2e1601fa..17e6c57b 100644 --- a/LunaTranslator/files/lang/ko.json +++ b/LunaTranslator/files/lang/ko.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "선택된 행을 현재 md5로 복사", "修改列表名称": "목록 이름 수정", "滚动到最后": "끝까지 스크롤", - "创建列表": "목록 만들기" + "创建列表": "목록 만들기", + "限制每行字数": "행당 단어 수 제한" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/pl.json b/LunaTranslator/files/lang/pl.json index 9572d161..1503c76a 100644 --- a/LunaTranslator/files/lang/pl.json +++ b/LunaTranslator/files/lang/pl.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "Kopiuj zaznaczony wiersz z bieżącym MD5", "修改列表名称": "Zmień nazwę listy", "滚动到最后": "Przewiń do końca", - "创建列表": "Utwórz listę" + "创建列表": "Utwórz listę", + "限制每行字数": "Ograniczenie liczby słów na wiersz" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ru.json b/LunaTranslator/files/lang/ru.json index e7fb33a3..1976672a 100644 --- a/LunaTranslator/files/lang/ru.json +++ b/LunaTranslator/files/lang/ru.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "Копировать выделенную строку в текущем MD5", "修改列表名称": "Изменить имя списка", "滚动到最后": "Прокрутить до конца", - "创建列表": "Создать список" + "创建列表": "Создать список", + "限制每行字数": "Ограничение количества слов в строке" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/th.json b/LunaTranslator/files/lang/th.json index 4f43db47..05560c34 100644 --- a/LunaTranslator/files/lang/th.json +++ b/LunaTranslator/files/lang/th.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "คัดลอกแถวที่เลือกด้วย md5 ปัจจุบัน", "修改列表名称": "แก้ไขชื่อรายการ", "滚动到最后": "เลื่อนไปจนสุด", - "创建列表": "สร้างรายการ" + "创建列表": "สร้างรายการ", + "限制每行字数": "จำกัดจำนวนคำต่อบรรทัด" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/tr.json b/LunaTranslator/files/lang/tr.json index 37ee27f2..17b7de19 100644 --- a/LunaTranslator/files/lang/tr.json +++ b/LunaTranslator/files/lang/tr.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "Seçili satırı mevcut MD5 ile kopyalayın", "修改列表名称": "Liste ismini değiştir", "滚动到最后": "Sonuna doğru yürüt", - "创建列表": "Liste oluştur" + "创建列表": "Liste oluştur", + "限制每行字数": "Sırada kelimelerin sayısını sınırla" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/uk.json b/LunaTranslator/files/lang/uk.json index a1a46f53..98c828e1 100644 --- a/LunaTranslator/files/lang/uk.json +++ b/LunaTranslator/files/lang/uk.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "Копіювати вибраний рядок поточним MD5", "修改列表名称": "Змінити назву списку", "滚动到最后": "Пересунутися до кінця", - "创建列表": "Створити список" + "创建列表": "Створити список", + "限制每行字数": "Обмежити кількість слів на рядок" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/vi.json b/LunaTranslator/files/lang/vi.json index a2c0bda5..dcdf42b6 100644 --- a/LunaTranslator/files/lang/vi.json +++ b/LunaTranslator/files/lang/vi.json @@ -810,5 +810,6 @@ "以当前md5复制选中行": "Dòng đã chọn sao chép md5 hiện tại", "修改列表名称": "Thay đổi tên danh sách", "滚动到最后": "Cuộn đến cuối", - "创建列表": "Tạo danh sách" + "创建列表": "Tạo danh sách", + "限制每行字数": "Giới hạn số lượng từ trên mỗi dòng" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/zh.json b/LunaTranslator/files/lang/zh.json index d8d2bb2f..90380cc9 100644 --- a/LunaTranslator/files/lang/zh.json +++ b/LunaTranslator/files/lang/zh.json @@ -810,5 +810,6 @@ "上传游戏": "", "以当前md5复制选中行": "", "修改列表名称": "", - "滚动到最后": "" + "滚动到最后": "", + "限制每行字数": "" } \ No newline at end of file