mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2026-03-06 09:27:33 +01:00
Avance
This commit is contained in:
14
srcantiguo/extra/translator/engines/deep_l.py
Normal file
14
srcantiguo/extra/translator/engines/deep_l.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import config
|
||||
from deepl import Translator
|
||||
|
||||
def translate(text: str, target_language: str) -> str:
|
||||
key = config.app["translator"]["deepl_api_key"]
|
||||
t = Translator(key)
|
||||
return t.translate_text(text, target_lang=target_language).text
|
||||
|
||||
def languages():
|
||||
key = config.app["translator"]["deepl_api_key"]
|
||||
t = Translator(key)
|
||||
langs = t.get_target_languages()
|
||||
return langs
|
||||
Reference in New Issue
Block a user