From e05aed69bc402767dcd16c0e90b26935c507ecfa 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: Sat, 17 Aug 2024 21:35:56 +0800
Subject: [PATCH] param
---
LunaTranslator/LunaTranslator/cishu/edict.py | 4 +-
LunaTranslator/LunaTranslator/cishu/edict2.py | 4 +-
.../LunaTranslator/cishu/linggesi.py | 2 +-
LunaTranslator/LunaTranslator/cishu/mdict.py | 2 +-
.../LunaTranslator/cishu/xiaoxueguan.py | 2 +-
.../files/defaultconfig/config.json | 48 +++++++++++++++++--
LunaTranslator/files/lang/ar.json | 3 +-
LunaTranslator/files/lang/cht.json | 3 +-
LunaTranslator/files/lang/cs.json | 3 +-
LunaTranslator/files/lang/de.json | 3 +-
LunaTranslator/files/lang/en.json | 3 +-
LunaTranslator/files/lang/es.json | 3 +-
LunaTranslator/files/lang/fr.json | 3 +-
LunaTranslator/files/lang/it.json | 3 +-
LunaTranslator/files/lang/ja.json | 3 +-
LunaTranslator/files/lang/ko.json | 3 +-
LunaTranslator/files/lang/nl.json | 3 +-
LunaTranslator/files/lang/pl.json | 3 +-
LunaTranslator/files/lang/pt.json | 3 +-
LunaTranslator/files/lang/ru.json | 3 +-
LunaTranslator/files/lang/sv.json | 3 +-
LunaTranslator/files/lang/th.json | 3 +-
LunaTranslator/files/lang/tr.json | 3 +-
LunaTranslator/files/lang/uk.json | 3 +-
LunaTranslator/files/lang/vi.json | 3 +-
LunaTranslator/files/lang/zh.json | 3 +-
26 files changed, 89 insertions(+), 33 deletions(-)
diff --git a/LunaTranslator/LunaTranslator/cishu/edict.py b/LunaTranslator/LunaTranslator/cishu/edict.py
index bdd856d1..33d53565 100644
--- a/LunaTranslator/LunaTranslator/cishu/edict.py
+++ b/LunaTranslator/LunaTranslator/cishu/edict.py
@@ -30,11 +30,9 @@ class edict(cishubase):
dis.append(d)
save = []
srt = argsort(dis)
- for ii in srt:
+ for ii in srt[: self.config["max_num"]]:
if exp[ii][1] not in save:
save.append(exp[ii][1])
- if len(save) >= 10:
- break
saveres = []
for _id in save:
x = self.sql.execute(
diff --git a/LunaTranslator/LunaTranslator/cishu/edict2.py b/LunaTranslator/LunaTranslator/cishu/edict2.py
index 27734f9e..550a9a09 100644
--- a/LunaTranslator/LunaTranslator/cishu/edict2.py
+++ b/LunaTranslator/LunaTranslator/cishu/edict2.py
@@ -38,10 +38,8 @@ class edict2(cishubase):
savew.append(w)
saveres = []
srt = argsort(dis)
- for ii in srt:
+ for ii in srt[: self.config["max_num"]]:
saveres.append(
savew[ii] + "
" + re.sub("/EntL.*/", "", self.save[savew[ii]][1:])
)
- if len(saveres) >= 10:
- break
return "
".join(saveres)
diff --git a/LunaTranslator/LunaTranslator/cishu/linggesi.py b/LunaTranslator/LunaTranslator/cishu/linggesi.py
index 0c032497..ef3e4dce 100644
--- a/LunaTranslator/LunaTranslator/cishu/linggesi.py
+++ b/LunaTranslator/LunaTranslator/cishu/linggesi.py
@@ -45,6 +45,6 @@ class linggesi(cishubase):
if d <= self.config["distance"]:
mp[w] = [xx, d]
- x = sorted(list(mp.keys()), key=lambda x: mp[x][1])[:10]
+ x = sorted(list(mp.keys()), key=lambda x: mp[x][1])[: self.config["max_num"]]
save = [w + "
" + mp[w][0] for w in x]
return "
".join(save)
diff --git a/LunaTranslator/LunaTranslator/cishu/mdict.py b/LunaTranslator/LunaTranslator/cishu/mdict.py
index f43bf6fb..04717e7b 100644
--- a/LunaTranslator/LunaTranslator/cishu/mdict.py
+++ b/LunaTranslator/LunaTranslator/cishu/mdict.py
@@ -2129,7 +2129,7 @@ class mdict(cishubase):
results.append(k)
diss[k] = dis
- return sorted(results, key=lambda x: diss[x])
+ return sorted(results, key=lambda x: diss[x])[: self.config["max_num"]]
def parse_strings(self, input_string):
parsed_strings = []
diff --git a/LunaTranslator/LunaTranslator/cishu/xiaoxueguan.py b/LunaTranslator/LunaTranslator/cishu/xiaoxueguan.py
index 56538ed6..de672c4d 100644
--- a/LunaTranslator/LunaTranslator/cishu/xiaoxueguan.py
+++ b/LunaTranslator/LunaTranslator/cishu/xiaoxueguan.py
@@ -45,6 +45,6 @@ class xiaoxueguan(cishubase):
if d <= self.config["distance"]:
dis.append(d)
- srt = argsort(dis)[:10]
+ srt = argsort(dis)[: self.config["max_num"]]
save = ["" + exp[i][1].replace("\\n", "") for i in srt]
return "
".join(save)
diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json
index 58b2fd7d..ffefea99 100644
--- a/LunaTranslator/files/defaultconfig/config.json
+++ b/LunaTranslator/files/defaultconfig/config.json
@@ -1211,7 +1211,8 @@
"xiaoxueguan": {
"args": {
"path": "",
- "distance": 0
+ "distance": 0,
+ "max_num": 10
},
"argstype": {
"path": {
@@ -1226,6 +1227,13 @@
"min": 0,
"max": 100,
"step": 1
+ },
+ "max_num": {
+ "type": "intspin",
+ "name": "最大结果条数",
+ "min": 0,
+ "max": 9999,
+ "step": 1
}
},
"use": false,
@@ -1237,7 +1245,8 @@
"name": "EDICT",
"args": {
"path": "",
- "distance": 0
+ "distance": 0,
+ "max_num": 10
},
"argstype": {
"path": {
@@ -1252,6 +1261,13 @@
"min": 0,
"max": 100,
"step": 1
+ },
+ "max_num": {
+ "type": "intspin",
+ "name": "最大结果条数",
+ "min": 0,
+ "max": 9999,
+ "step": 1
}
},
"type": "offline"
@@ -1261,7 +1277,8 @@
"name": "EDICT2",
"args": {
"path": "",
- "distance": 0
+ "distance": 0,
+ "max_num": 10
},
"argstype": {
"path": {
@@ -1275,6 +1292,13 @@
"min": 0,
"max": 100,
"step": 1
+ },
+ "max_num": {
+ "type": "intspin",
+ "name": "最大结果条数",
+ "min": 0,
+ "max": 9999,
+ "step": 1
}
},
"type": "offline"
@@ -1284,7 +1308,8 @@
"name": "灵格斯词典",
"args": {
"path": "",
- "distance": 0
+ "distance": 0,
+ "max_num": 10
},
"argstype": {
"path": {
@@ -1298,6 +1323,13 @@
"min": 0,
"max": 100,
"step": 1
+ },
+ "max_num": {
+ "type": "intspin",
+ "name": "最大结果条数",
+ "min": 0,
+ "max": 9999,
+ "step": 1
}
},
"type": "offline"
@@ -1325,6 +1357,7 @@
"args": {
"paths": [],
"distance": 0,
+ "max_num": 10,
"stylehv": 0
},
"argstype": {
@@ -1342,6 +1375,13 @@
"max": 100,
"step": 1
},
+ "max_num": {
+ "type": "intspin",
+ "name": "最大结果条数",
+ "min": 0,
+ "max": 9999,
+ "step": 1
+ },
"stylehv": {
"type": "combo",
"name": "样式",
diff --git a/LunaTranslator/files/lang/ar.json b/LunaTranslator/files/lang/ar.json
index b7a16e69..f8e65ae7 100644
--- a/LunaTranslator/files/lang/ar.json
+++ b/LunaTranslator/files/lang/ar.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "ترتيب عرض القاموس",
"背景窗口透明": "نافذة خلفية شفافة",
"文件翻译": "ترجمة الوثائق",
- "文件": "الوثائق"
+ "文件": "الوثائق",
+ "最大结果条数": "أقصى عدد من النتائج"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/cht.json b/LunaTranslator/files/lang/cht.json
index ee200fb7..74670bcd 100644
--- a/LunaTranslator/files/lang/cht.json
+++ b/LunaTranslator/files/lang/cht.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "辭書顯示順序",
"背景窗口透明": "背景視窗透明",
"文件翻译": "檔案翻譯",
- "文件": "文件"
+ "文件": "文件",
+ "最大结果条数": "最大結果條數"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/cs.json b/LunaTranslator/files/lang/cs.json
index cba52edd..5d78978b 100644
--- a/LunaTranslator/files/lang/cs.json
+++ b/LunaTranslator/files/lang/cs.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Lexikografické pořadí zobrazení",
"背景窗口透明": "Okno pozadí transparentní",
"文件翻译": "dokumentární překlad",
- "文件": "soubor"
+ "文件": "soubor",
+ "最大结果条数": "Maximální počet výsledků"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/de.json b/LunaTranslator/files/lang/de.json
index 44b2cdd0..5530f506 100644
--- a/LunaTranslator/files/lang/de.json
+++ b/LunaTranslator/files/lang/de.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Lexikographische Anzeigereihenfolge",
"背景窗口透明": "Hintergrundfenster transparent",
"文件翻译": "Übersetzung von Dokumenten",
- "文件": "Datei"
+ "文件": "Datei",
+ "最大结果条数": "Maximale Anzahl der Ergebnisse"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/en.json b/LunaTranslator/files/lang/en.json
index 9e8252f5..c76418a8 100644
--- a/LunaTranslator/files/lang/en.json
+++ b/LunaTranslator/files/lang/en.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Lexicographical display order",
"背景窗口透明": "Background window transparent",
"文件翻译": "documentary translation",
- "文件": "file"
+ "文件": "file",
+ "最大结果条数": "Maximum number of results"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/es.json b/LunaTranslator/files/lang/es.json
index 8ee773ff..c1fcd691 100644
--- a/LunaTranslator/files/lang/es.json
+++ b/LunaTranslator/files/lang/es.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Orden de visualización del diccionario",
"背景窗口透明": "La ventana de fondo es transparente",
"文件翻译": "Traducción de documentos",
- "文件": "Documentos"
+ "文件": "Documentos",
+ "最大结果条数": "Número máximo de resultados"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/fr.json b/LunaTranslator/files/lang/fr.json
index b2fae7d5..eeca7abc 100644
--- a/LunaTranslator/files/lang/fr.json
+++ b/LunaTranslator/files/lang/fr.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Ordre d'affichage des discours",
"背景窗口透明": "Fenêtre de fond transparente",
"文件翻译": "Traduction de documents",
- "文件": "Documents"
+ "文件": "Documents",
+ "最大结果条数": "Nombre maximal de barres de résultats"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/it.json b/LunaTranslator/files/lang/it.json
index 9f9bb5da..084c5a91 100644
--- a/LunaTranslator/files/lang/it.json
+++ b/LunaTranslator/files/lang/it.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Ordine di visualizzazione lessicografico",
"背景窗口透明": "Finestra di sfondo trasparente",
"文件翻译": "traduzione documentaria",
- "文件": "file"
+ "文件": "file",
+ "最大结果条数": "Numero massimo di risultati"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/ja.json b/LunaTranslator/files/lang/ja.json
index 96aaf826..7338a630 100644
--- a/LunaTranslator/files/lang/ja.json
+++ b/LunaTranslator/files/lang/ja.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "辞書の表示順序",
"背景窗口透明": "背景ウィンドウの透過性",
"文件翻译": "ファイル翻訳",
- "文件": "ファイル"
+ "文件": "ファイル",
+ "最大结果条数": "最大結果バー数"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/ko.json b/LunaTranslator/files/lang/ko.json
index b1bf790c..a20c982c 100644
--- a/LunaTranslator/files/lang/ko.json
+++ b/LunaTranslator/files/lang/ko.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "사서 표시 순서",
"背景窗口透明": "배경 창 투명도",
"文件翻译": "파일 번역",
- "文件": "파일"
+ "文件": "파일",
+ "最大结果条数": "최대 결과 개수"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/nl.json b/LunaTranslator/files/lang/nl.json
index 93409d73..5365521b 100644
--- a/LunaTranslator/files/lang/nl.json
+++ b/LunaTranslator/files/lang/nl.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Lexicografische weergavevolgorde",
"背景窗口透明": "Achtergrondvenster transparant",
"文件翻译": "documentaire vertaling",
- "文件": "bestand"
+ "文件": "bestand",
+ "最大结果条数": "Maximaal aantal resultaten"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/pl.json b/LunaTranslator/files/lang/pl.json
index 201f93b7..38e067e4 100644
--- a/LunaTranslator/files/lang/pl.json
+++ b/LunaTranslator/files/lang/pl.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Kolejność wyświetlania leksygraficznego",
"背景窗口透明": "Okno tła przejrzyste",
"文件翻译": "tłumaczenie dokumentów",
- "文件": "plik"
+ "文件": "plik",
+ "最大结果条数": "Maksymalna liczba wyników"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/pt.json b/LunaTranslator/files/lang/pt.json
index d26b7066..313ad0ac 100644
--- a/LunaTranslator/files/lang/pt.json
+++ b/LunaTranslator/files/lang/pt.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Ordem de visualização lexicográfica",
"背景窗口透明": "Janela de fundo transparente",
"文件翻译": "tradução documental",
- "文件": "ficheiro"
+ "文件": "ficheiro",
+ "最大结果条数": "Número máximo de resultados"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/ru.json b/LunaTranslator/files/lang/ru.json
index 2ded3b84..b5cd445f 100644
--- a/LunaTranslator/files/lang/ru.json
+++ b/LunaTranslator/files/lang/ru.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Словарь показывает порядок",
"背景窗口透明": "Фоновое окно прозрачно",
"文件翻译": "Перевод документов",
- "文件": "Документация"
+ "文件": "Документация",
+ "最大结果条数": "Максимальное число итоговых полос"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/sv.json b/LunaTranslator/files/lang/sv.json
index d6473ace..1c0cf830 100644
--- a/LunaTranslator/files/lang/sv.json
+++ b/LunaTranslator/files/lang/sv.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Lexikografisk visningsordning",
"背景窗口透明": "Bakgrundsfönster genomskinligt",
"文件翻译": "dokumentär översättning",
- "文件": "fil"
+ "文件": "fil",
+ "最大结果条数": "Maximalt antal resultat"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/th.json b/LunaTranslator/files/lang/th.json
index a271ac9a..de0a4f35 100644
--- a/LunaTranslator/files/lang/th.json
+++ b/LunaTranslator/files/lang/th.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "ลำดับการแสดงสำนวน",
"背景窗口透明": "หน้าต่างพื้นหลังโปร่งใส",
"文件翻译": "แปลเอกสาร",
- "文件": "แฟ้ม"
+ "文件": "แฟ้ม",
+ "最大结果条数": "จำนวนแถบผลลัพธ์สูงสุด"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/tr.json b/LunaTranslator/files/lang/tr.json
index cb5989d1..c0d29935 100644
--- a/LunaTranslator/files/lang/tr.json
+++ b/LunaTranslator/files/lang/tr.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Lexicographical display order",
"背景窗口透明": "Arkaplan penceresi transparent",
"文件翻译": "belgeler çeviri",
- "文件": "dosya"
+ "文件": "dosya",
+ "最大结果条数": "En yüksek sonuçların sayısı"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/uk.json b/LunaTranslator/files/lang/uk.json
index 7f9a4096..c8de0cea 100644
--- a/LunaTranslator/files/lang/uk.json
+++ b/LunaTranslator/files/lang/uk.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Лексикографічний порядок показу",
"背景窗口透明": "Прозоре вікно тла",
"文件翻译": "документарний переклад",
- "文件": "файл"
+ "文件": "файл",
+ "最大结果条数": "Максимальна кількість результатів"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/vi.json b/LunaTranslator/files/lang/vi.json
index b0756119..cb36daf5 100644
--- a/LunaTranslator/files/lang/vi.json
+++ b/LunaTranslator/files/lang/vi.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "Trình tự hiển thị từ điển",
"背景窗口透明": "Trong suốt cửa sổ nền",
"文件翻译": "Dịch tài liệu",
- "文件": "Tài liệu"
+ "文件": "Tài liệu",
+ "最大结果条数": "Số thanh kết quả tối đa"
}
\ No newline at end of file
diff --git a/LunaTranslator/files/lang/zh.json b/LunaTranslator/files/lang/zh.json
index 1e54510f..795e5236 100644
--- a/LunaTranslator/files/lang/zh.json
+++ b/LunaTranslator/files/lang/zh.json
@@ -830,5 +830,6 @@
"辞书显示顺序": "",
"背景窗口透明": "",
"文件翻译": "",
- "文件": ""
+ "文件": "",
+ "最大结果条数": ""
}
\ No newline at end of file