Add: Translate to target language in config.ini
This commit is contained in:
@@ -301,7 +301,7 @@ def get_html_by_scraper(url: str = None, cookies: dict = None, ua: str = None, r
|
|||||||
|
|
||||||
def translate(
|
def translate(
|
||||||
src: str,
|
src: str,
|
||||||
target_language: str = "zh_cn",
|
target_language: str = config.getInstance().get_target_language(),
|
||||||
engine: str = "google-free",
|
engine: str = "google-free",
|
||||||
app_id: str = "",
|
app_id: str = "",
|
||||||
key: str = "",
|
key: str = "",
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ switch = 0
|
|||||||
switch = 0
|
switch = 0
|
||||||
;可选项 google-free,azure,deeplx
|
;可选项 google-free,azure,deeplx
|
||||||
engine = google-free
|
engine = google-free
|
||||||
; azure翻译密钥
|
target_language = zh_cn
|
||||||
|
; azure翻译密钥key
|
||||||
key =
|
key =
|
||||||
; 翻译延迟
|
; 翻译延迟
|
||||||
delay = 1
|
delay = 1
|
||||||
|
|||||||
@@ -279,6 +279,9 @@ class Config:
|
|||||||
def get_translate_engine(self) -> str:
|
def get_translate_engine(self) -> str:
|
||||||
return self.conf.get("translate", "engine")
|
return self.conf.get("translate", "engine")
|
||||||
|
|
||||||
|
def get_target_language(self) -> str:
|
||||||
|
return self.conf.get("translate", "target_language")
|
||||||
|
|
||||||
# def get_translate_appId(self) ->str:
|
# def get_translate_appId(self) ->str:
|
||||||
# return self.conf.get("translate","appid")
|
# return self.conf.get("translate","appid")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user