mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
deeplx
This commit is contained in:
parent
545503244d
commit
d256d19bf5
25
LunaTranslator/LunaTranslator/translator/DeepLX.py
Normal file
25
LunaTranslator/LunaTranslator/translator/DeepLX.py
Normal file
@ -0,0 +1,25 @@
|
||||
from myutils.config import static_data
|
||||
import time
|
||||
from translator.basetranslator import basetrans
|
||||
|
||||
|
||||
class TS(basetrans):
|
||||
def langmap(self):
|
||||
x = {_: _.upper() for _ in static_data["language_list_translator_inner"]}
|
||||
x.pop("cht")
|
||||
return x # {"zh":"ZH","ja":"JA","en":"EN","es":"ES","fr":"FR","ru":"RU"}
|
||||
|
||||
def translate(self, query):
|
||||
|
||||
payload = {
|
||||
"text": query,
|
||||
"source_lang": self.srclang,
|
||||
"target_lang": self.tgtlang,
|
||||
}
|
||||
|
||||
response = self.session.post(self.config["api"], json=payload)
|
||||
|
||||
try:
|
||||
return response.json()["data"]
|
||||
except:
|
||||
raise Exception(response.text)
|
@ -856,11 +856,18 @@
|
||||
"use": false,
|
||||
"color": "blue",
|
||||
"name": "deepl"
|
||||
},"deepl2": {
|
||||
},
|
||||
"deepl2": {
|
||||
"use": false,
|
||||
"color": "blue",
|
||||
"name": "deepl_v2"
|
||||
},
|
||||
"DeepLX": {
|
||||
"use": false,
|
||||
"color": "blue",
|
||||
"name": "DeepLX",
|
||||
"useproxy":false
|
||||
},
|
||||
"dev_chatgpt":{
|
||||
"use": false,
|
||||
"color": "blue",
|
||||
|
@ -4,6 +4,11 @@
|
||||
"host": "translate.plausibility.cloud"
|
||||
}
|
||||
},
|
||||
"DeepLX":{
|
||||
"args": {
|
||||
"api": "https://api.deeplx.org/translate"
|
||||
}
|
||||
},
|
||||
"baiduapi": {
|
||||
"args": {
|
||||
"注册网址": "https://fanyi-api.baidu.com/api/trans/product/desktop",
|
||||
|
Loading…
x
Reference in New Issue
Block a user