Skip to content

Localized

Localized #

fallback class-attribute instance-attribute #
fallback: str | None = None

You should use this in your localization provider build_localized function, because...

#   Before: Localized(value="commands.hi.description", fallback=None)

LocalizationProvider.build_localized(Localized)

# For example.
# There is `build_localized` will put a first translation into fallback.
# But you can do anything you want.
#
#   After: Localized(value={"ro": "Salutați botul", "lt": "Pasisveikinkite su botu"}, fallback="Salutați botul")
#
# And fallback will be used for default description (for example) of command
# and value for description_localizations of command.
value instance-attribute #
value: str | Dict[str, Any]

Key.

After building it will be replaced by translations. Look out fallback for more information.