From 62977aa2c8fea72287b9d793e2589ee83c7ccd5d Mon Sep 17 00:00:00 2001 From: yoshiko2 Date: Thu, 4 May 2023 04:42:08 +0800 Subject: [PATCH] Add: Translate to target language in config.ini --- ADC_function.py | 2 +- config.ini | 3 ++- config.py | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ADC_function.py b/ADC_function.py index e69db37..5b099ef 100644 --- a/ADC_function.py +++ b/ADC_function.py @@ -301,7 +301,7 @@ def get_html_by_scraper(url: str = None, cookies: dict = None, ua: str = None, r def translate( src: str, - target_language: str = "zh_cn", + target_language: str = config.getInstance().get_target_language(), engine: str = "google-free", app_id: str = "", key: str = "", diff --git a/config.ini b/config.ini index 857079c..db4230e 100755 --- a/config.ini +++ b/config.ini @@ -71,7 +71,8 @@ switch = 0 switch = 0 ;可选项 google-free,azure,deeplx engine = google-free -; azure翻译密钥 +target_language = zh_cn +; azure翻译密钥key key = ; 翻译延迟 delay = 1 diff --git a/config.py b/config.py index c655135..22bec56 100644 --- a/config.py +++ b/config.py @@ -279,6 +279,9 @@ class Config: def get_translate_engine(self) -> str: 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: # return self.conf.get("translate","appid")