This commit is contained in:
恍兮惚兮 2024-11-09 15:38:12 +08:00
parent ac7843ee40
commit 7bc0f9391a
4 changed files with 36 additions and 27 deletions

View File

@ -1,6 +1,6 @@
set(VERSION_MAJOR 5)
set(VERSION_MINOR 56)
set(VERSION_PATCH 6)
set(VERSION_PATCH 7)
include(${CMAKE_CURRENT_LIST_DIR}/version/generate_product_version.cmake)

View File

@ -2,10 +2,10 @@ from qtsymbols import *
import threading, windows
import gobject, qtawesome, os, json
from myutils.config import globalconfig, savehook_new_data, translatorsetting
from myutils.utils import translate_exits, dynamicapiname
from myutils.wrapper import Singleton_close
from gui.usefulwidget import saveposwindow, getsimplecombobox
from gui.dynalang import LPushButton, LMainWindow
from gui.setting_textinput import loadvalidtss
@Singleton_close
@ -153,14 +153,7 @@ class edittrans(LMainWindow):
w.setLayout(qv)
self.textOutput.enterpressed.connect(self.submitfunction)
submit = LPushButton("确定")
vis, inter = [], []
for fanyi in globalconfig["fanyi"]:
if fanyi == "premt":
continue
if not translate_exits(fanyi):
continue
inter.append(fanyi)
vis.append(dynamicapiname(fanyi))
inter, vis = loadvalidtss()
qv.addWidget(self.textOutput)
qv.addWidget(
getsimplecombobox(

View File

@ -270,11 +270,26 @@ def loadvalidtss():
alltransvis = []
alltrans = []
for x in globalconfig["fanyi"]:
if x == "premt":
continue
if not translate_exits(x):
continue
alltransvis.append(dynamicapiname(x))
tp = globalconfig["fanyi"][x].get("type", "free")
alltransvis.append(
dynamicapiname(x)
+ "_("
+ {
"free": "在线翻译",
"api": "注册在线翻译",
"dev": "调试浏览器",
"pre": "预翻译",
"offline": "离线翻译",
}.get(tp, "unknown type")
+ ")"
)
alltrans.append(x)
return alltrans, alltransvis
sorted_pairs = sorted(zip(alltransvis, alltrans))
return [x[1] for x in sorted_pairs], [x[0] for x in sorted_pairs]
def gethookembedgrid(self):

View File

@ -571,23 +571,24 @@ def loadlanguage():
languageshow = {}
def _TR(k):
if k == "":
def _TR(k: str):
if not k:
return ""
try:
k.encode("ascii")
if k.isascii():
return k
except:
loadlanguage()
if "_" in k:
splits = k.split("_")
return " ".join([_TR(_) for _ in splits])
if k not in languageshow or languageshow[k] == "":
languageshow[k] = ""
return k
else:
return languageshow[k]
loadlanguage()
if "_" in k:
splits = k.split("_")
return " ".join([_TR(_) for _ in splits])
__ = languageshow.get(k)
if not __:
if k.startswith("(") and k.endswith(")"):
__ = languageshow.get(k[1:-1])
if __:
__ = "(" + __ + ")"
if not __:
__ = k
return __
lastapppath = globalconfig["lastapppath"]