mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
fix
This commit is contained in:
parent
ac7843ee40
commit
7bc0f9391a
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
set(VERSION_MAJOR 5)
|
set(VERSION_MAJOR 5)
|
||||||
set(VERSION_MINOR 56)
|
set(VERSION_MINOR 56)
|
||||||
set(VERSION_PATCH 6)
|
set(VERSION_PATCH 7)
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/version/generate_product_version.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/version/generate_product_version.cmake)
|
@ -2,10 +2,10 @@ from qtsymbols import *
|
|||||||
import threading, windows
|
import threading, windows
|
||||||
import gobject, qtawesome, os, json
|
import gobject, qtawesome, os, json
|
||||||
from myutils.config import globalconfig, savehook_new_data, translatorsetting
|
from myutils.config import globalconfig, savehook_new_data, translatorsetting
|
||||||
from myutils.utils import translate_exits, dynamicapiname
|
|
||||||
from myutils.wrapper import Singleton_close
|
from myutils.wrapper import Singleton_close
|
||||||
from gui.usefulwidget import saveposwindow, getsimplecombobox
|
from gui.usefulwidget import saveposwindow, getsimplecombobox
|
||||||
from gui.dynalang import LPushButton, LMainWindow
|
from gui.dynalang import LPushButton, LMainWindow
|
||||||
|
from gui.setting_textinput import loadvalidtss
|
||||||
|
|
||||||
|
|
||||||
@Singleton_close
|
@Singleton_close
|
||||||
@ -153,14 +153,7 @@ class edittrans(LMainWindow):
|
|||||||
w.setLayout(qv)
|
w.setLayout(qv)
|
||||||
self.textOutput.enterpressed.connect(self.submitfunction)
|
self.textOutput.enterpressed.connect(self.submitfunction)
|
||||||
submit = LPushButton("确定")
|
submit = LPushButton("确定")
|
||||||
vis, inter = [], []
|
inter, vis = loadvalidtss()
|
||||||
for fanyi in globalconfig["fanyi"]:
|
|
||||||
if fanyi == "premt":
|
|
||||||
continue
|
|
||||||
if not translate_exits(fanyi):
|
|
||||||
continue
|
|
||||||
inter.append(fanyi)
|
|
||||||
vis.append(dynamicapiname(fanyi))
|
|
||||||
qv.addWidget(self.textOutput)
|
qv.addWidget(self.textOutput)
|
||||||
qv.addWidget(
|
qv.addWidget(
|
||||||
getsimplecombobox(
|
getsimplecombobox(
|
||||||
|
@ -270,11 +270,26 @@ def loadvalidtss():
|
|||||||
alltransvis = []
|
alltransvis = []
|
||||||
alltrans = []
|
alltrans = []
|
||||||
for x in globalconfig["fanyi"]:
|
for x in globalconfig["fanyi"]:
|
||||||
|
if x == "premt":
|
||||||
|
continue
|
||||||
if not translate_exits(x):
|
if not translate_exits(x):
|
||||||
continue
|
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)
|
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):
|
def gethookembedgrid(self):
|
||||||
|
@ -571,23 +571,24 @@ def loadlanguage():
|
|||||||
languageshow = {}
|
languageshow = {}
|
||||||
|
|
||||||
|
|
||||||
def _TR(k):
|
def _TR(k: str):
|
||||||
if k == "":
|
if not k:
|
||||||
return ""
|
return ""
|
||||||
try:
|
if k.isascii():
|
||||||
k.encode("ascii")
|
|
||||||
return k
|
return k
|
||||||
except:
|
loadlanguage()
|
||||||
loadlanguage()
|
if "_" in k:
|
||||||
if "_" in k:
|
splits = k.split("_")
|
||||||
splits = k.split("_")
|
return " ".join([_TR(_) for _ in splits])
|
||||||
return " ".join([_TR(_) for _ in splits])
|
__ = languageshow.get(k)
|
||||||
|
if not __:
|
||||||
if k not in languageshow or languageshow[k] == "":
|
if k.startswith("(") and k.endswith(")"):
|
||||||
languageshow[k] = ""
|
__ = languageshow.get(k[1:-1])
|
||||||
return k
|
if __:
|
||||||
else:
|
__ = "(" + __ + ")"
|
||||||
return languageshow[k]
|
if not __:
|
||||||
|
__ = k
|
||||||
|
return __
|
||||||
|
|
||||||
|
|
||||||
lastapppath = globalconfig["lastapppath"]
|
lastapppath = globalconfig["lastapppath"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user