Translations

Forms for creating, modifying and configuring machine translations

Translations Management Form

class integreat_cms.cms.forms.translations.translations_management_form.CustomCheckboxSelectMultiple(attrs=None, choices=())[source]

Bases: CheckboxSelectMultiple

Custom CheckboxSelectMultiple child class which appends a machine translation provider to option labels or disables them if no provider is available

template_name: str = 'translations/languages_input.html'[source]

The template to use when rendering this widget

class integreat_cms.cms.forms.translations.translations_management_form.TranslationLanguageOptions(language_tree_node: LanguageTreeNode)[source]

Bases: object

Helper class to easily provide the translation providers for a language for form fields.

Parameters:

language_tree_node (LanguageTreeNode) –

__init__(language_tree_node: LanguageTreeNode) None[source]
Parameters:

language_tree_node (LanguageTreeNode) –

Return type:

None

property choices: list[tuple[str, str]][source]

mt_providers as list of tuples for django.forms.ChoiceField.choices

property initial: str[source]

mt_provider.name for django.forms.Field.initial

property providers: dict[str, MachineTranslationProviderType][source]

mt_providers as a dict, indexed by name

class integreat_cms.cms.forms.translations.translations_management_form.TranslationsManagementForm(*args: Any, **kwargs: Any)[source]

Bases: CustomModelForm

Form for modifying machine translation settings of a region

Form fields:

Parameters:
  • args (Any) –

  • kwargs (Any) –

__init__(*args: Any, **kwargs: Any) None[source]

Initialize translations management form

Parameters:
  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Return type:

None

get_language_fields() Iterator[forms.ChoiceField][source]

Generator for a django.forms.ChoiceField for each language with the available translation providers

Return type:

Iterator[forms.ChoiceField]

property media[source]

Return all media required to render the widgets on this form.

save(commit: bool = True) Region[source]

This method extends the default save()-method of the base ModelForm to set attributes which are not directly determined by input fields.

Parameters:

commit (bool) – Whether or not the changes should be written to the database

Returns:

The saved region object

Return type:

Region

unavailable_languages: list[str] = [][source]

The languages that cannot be selected at the moment