Deepl API
Apps
Configuration of DeepL API app
- class integreat_cms.deepl_api.apps.DeepLApiClientConfig(app_name, app_module)[source]
Bases:
AppConfig
DeepL API config inheriting the django AppConfig
- static assert_usage_limit_not_reached(translator: Translator) None [source]
Requests the usage from the translator and asserts that no limit was reached
- Parameters:
translator (Translator) – The deepl translator
- Return type:
None
- get_glossary(source_language: str, target_language: str) GlossaryInfo | None [source]
Looks up a glossary for the specified source language and target language pair. This method also returns the correct glossary for region variants (for example en-gb)
- init_supported_glossaries(translator: Translator) None [source]
Requests the supported glossaries from the translator and sets them
- Parameters:
translator (Translator) – The deepl translator
- Return type:
None
- init_supported_source_languages(translator: Translator) None [source]
Requests the supported sources languages from the translator and sets them
- Parameters:
translator (Translator) – The deepl translator
- Return type:
None
- init_supported_target_languages(translator: Translator) None [source]
Requests the supported target languages from the translator and sets them
- Parameters:
translator (Translator) – The deepl translator
- Return type:
None
- supported_glossaries: dict[tuple[str, str], GlossaryInfo] = {}[source]
The supported glossaries, a map from (source_language, target_language) to glossary info
- verbose_name: Final[Promise] = 'DeepL API'[source]
Human-readable name for the application
Deepl API Client
- class integreat_cms.deepl_api.deepl_api_client.DeepLApiClient(request: HttpRequest, form_class: ModelFormMetaclass)[source]
Bases:
MachineTranslationApiClient
DeepL API client to automatically translate selected objects.
- Parameters:
request (HttpRequest)
form_class (ModelFormMetaclass)
- __init__(request: HttpRequest, form_class: ModelFormMetaclass) None [source]
Initialize the DeepL client
- Parameters:
region – The current region
form_class (ModelFormMetaclass) – The
CustomContentModelForm
subclass of the current content typerequest (HttpRequest)
- Return type:
None
- static get_target_language_key(target_language: Language) str [source]
This function decides the correct target language key
Deepl Provider
- class integreat_cms.deepl_api.deepl_provider.DeepLProvider[source]
Bases:
MachineTranslationProvider
The provider for DeepL machine translations
- api_client[source]
The API client class for this provider
alias of
DeepLApiClient