mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
lang
This commit is contained in:
parent
03c8948d1a
commit
bd4f1da8c8
@ -37,11 +37,11 @@ class commonbase:
|
||||
return self.langmap_.get(self.srclang_1, "")
|
||||
|
||||
@property
|
||||
def srclang_1(self):
|
||||
def srclang_1(self) -> str:
|
||||
return getlangsrc()
|
||||
|
||||
@property
|
||||
def tgtlang_1(self):
|
||||
def tgtlang_1(self) -> str:
|
||||
return getlangtgt()
|
||||
|
||||
@property
|
||||
|
@ -55,10 +55,17 @@ def initDeepLXData(sourceLang: str, targetLang: str):
|
||||
|
||||
|
||||
class TS(basetrans):
|
||||
def langmap(self):
|
||||
x = {_: _.upper() for _ in [_["code"] for _ in static_data["lang_list_all"]]}
|
||||
x.pop("cht")
|
||||
return x # {"zh":"ZH","ja":"JA","en":"EN","es":"ES","fr":"FR","ru":"RU"}
|
||||
@property
|
||||
def srclang(self):
|
||||
if self.srclang_1 == "cht":
|
||||
return "ZH"
|
||||
return self.srclang_1.upper()
|
||||
|
||||
@property
|
||||
def tgtlang(self):
|
||||
if self.tgtlang_1 == "cht":
|
||||
return "ZH-HANT"
|
||||
return self.tgtlang_1.upper()
|
||||
|
||||
def translate(self, translateText):
|
||||
if self.config["usewhich"] == 0:
|
||||
|
@ -5,6 +5,18 @@ from translator.basetranslator_dev import basetransdev
|
||||
class TS(basetransdev):
|
||||
target_url = "https://www.deepl.com/en/translator"
|
||||
|
||||
@property
|
||||
def srclang(self):
|
||||
if self.srclang_1 == "cht":
|
||||
return "zh"
|
||||
return self.srclang_1.upper()
|
||||
|
||||
@property
|
||||
def tgtlang(self):
|
||||
if self.tgtlang_1 == "cht":
|
||||
return "zh-hant"
|
||||
return self.tgtlang_1
|
||||
|
||||
def translate(self, content):
|
||||
self.Page_navigate(
|
||||
"https://www.deepl.com/en/translator#{}/{}/{}".format(
|
||||
|
@ -4,10 +4,18 @@ from translator.basetranslator import basetrans
|
||||
|
||||
|
||||
class TS(basetrans):
|
||||
def langmap(self):
|
||||
x = {_: _.upper() for _ in [_["code"] for _ in static_data["lang_list_all"]]}
|
||||
x.pop("cht")
|
||||
return x
|
||||
|
||||
@property
|
||||
def srclang(self):
|
||||
if self.srclang_1 == "cht":
|
||||
return "ZH"
|
||||
return self.srclang_1.upper()
|
||||
|
||||
@property
|
||||
def tgtlang(self):
|
||||
if self.tgtlang_1 == "cht":
|
||||
return "ZH-HANT"
|
||||
return self.tgtlang_1.upper()
|
||||
|
||||
def translate(self, query):
|
||||
if self.config["usewhich"] == 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user