betty.locale.localizable.config module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.locale.localizable.config module

Provide localizable configuration.

final class betty.locale.localizable.config.StaticTranslationsLocalizableConfiguration

  Bases: `Configuration`, `Localizable`

  Provide configuration for a `betty.locale.Localizable`.

  Read more at multiple translations.

  __init__(translations: Mapping[str, str] | str | None = None, *, minimum: int = 1)
    Parameters:

      translations – Keys are locales, values are translations.

  dump() → bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void]

    Dump this instance to a portable format.

  load(dump: bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]]) → None

    Load dumped configuration.

    Raises:

      betty.assertion.error.AssertionFailed – Raised if the dump contains invalid configuration.

  localize(localizer: Localizer) → str

    Localize `self` to a human-readable string.

  set(translations: Mapping[str, str] | str) → None

    Set the translations.

  update(other: Self) → None

    Update this configuration with the values from `other`.

final class betty.locale.localizable.config.StaticTranslationsLocalizableConfigurationProperty

  Bases: `object`

  A property (similar to `property()`) that contains `betty.locale.localizable.StaticTranslationsLocalizableConfiguration`.

  __init__(attr_name: str, *, minimum: int = 1)