betty.localizable package#

Submodules#

Module contents#

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

class betty.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.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.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.localizable.resolve_localizable(localizable: ResolvableLocalizable) Localizable#

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