pibot.translation_service package
pibot.translation_service.deepl_translator module
DeepL translator service.
-
class pibot.translation_service.deepl_translator.DeepLTranslator(api_key: str)
Bases: Translator
DeepL translator service.
-
get_available_language() → list[str]
Get the available languages for translation.
- Returns:
A list of available languages.
-
translate(text: str, target_lang: str) → str
Translate the given text to the target language.
- Parameters:
-
- Returns:
The translated text.
pibot.translation_service.translator module
Abstract base class for translation services.
-
class pibot.translation_service.translator.Translator
Bases: ABC
Abstract base class for translation services.
-
abstractmethod get_available_language() → list[str]
Get the available languages for translation.
- Returns:
A list of available languages.
-
abstractmethod translate(text: str, target_lang: str) → str
Translate the given text to the target language.
- Parameters:
-
- Returns:
The translated text.
Module contents
Translation service package.