betty.locale.localizable package

Subpackages

Submodules

Module contents

The localizable API allows objects to be localized at the point of use.

class betty.locale.localizable.CountableLocalizable

Bases: _Localizable[CountableLocalizable]

An object that can be localized for a specific count (number of things).

abstractmethod count(count: LocalizableCount, /) Localizable

Create a localizable for the given count (number of things).

Implementations MUST automatically format the returned localizable with a {count} argument set to count.

format(**format_kwargs: ResolvableLocalizable) CountableLocalizable

Apply string formatting to the eventual localized string.

The arguments are identical to those of str.format().

Returns:

A new localizable object.

class betty.locale.localizable.Localizable

Bases: _Localizable[Localizable]

A localizable object.

Objects of this type can convert themselves to localized strings at the point of use.

format(**format_kwargs: ResolvableLocalizable) Localizable

Apply string formatting to the eventual localized string.

The arguments are identical to those of str.format().

Returns:

A new localizable object.

abstractmethod localize(localizer: Localizer, /) LocalizedStr

Localize self to a human-readable string.

betty.locale.localizable.resolve_countable_localizable(localizable: ResolvableCountableLocalizable) CountableLocalizable

Ensure that a countable-localizable-like value is or is made to be an actual countable localizable.

betty.locale.localizable.resolve_localizable(localizable: ResolvableLocalizable) Localizable

Ensure that a localizable-like value is or is made to be an actual localizable.