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

name: Final[str] = 'integreat_cms.deepl_api'[source]

Full Python path to the application

ready() None[source]

Checking if API is available

Return type:

None

supported_source_languages: list[str] = [][source]

The supported source languages

supported_target_languages: list[str] = [][source]

The supported target languages

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 type

  • request (HttpRequest) –

Return type:

None

static get_target_language_key(target_language: Language) str[source]

This function decides the correct target language key

Parameters:

target_language (Language) – the target language

Returns:

target_language_key which is 2 characters long for all languages except English and Portugese where the BCP tag is transmitted

Return type:

str

translate_queryset(queryset: list[Event] | list[Page] | list[POI], language_slug: str) None[source]

This function translates a content queryset via DeepL

Parameters:
Return type:

None

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

enabled: bool = False[source]

Whether the provider is globally enabled

name: str = 'DeepL'[source]

The readable name for this provider

supported_source_languages: list[str] = [][source]

The supported source languages

supported_target_languages: list[str] = [][source]

The supported target languages