This commit is contained in:
恍兮惚兮 2024-09-22 13:17:30 +08:00
parent 03c8948d1a
commit bd4f1da8c8
4 changed files with 37 additions and 10 deletions

View File

@ -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

View File

@ -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:

View File

@ -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(

View File

@ -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: