lightbulb.localization¶
- class DictLocalizationProvider(localizations: Mapping[Locale, Mapping[str, str]])[source]¶
Basic localization provider that supplies localizations from a single dictionary.
- class GnuLocalizationProvider(filename: str, directory: str = 'translations', category: str = 'LC_MESSAGES')[source]¶
Localization provider that parses localizations from gnu gettext compatible ‘.po’ or ‘.mo’ file paths. This provider expects localizations to be available from the file structure expected by gettext.
I.e.
{directory}/{locale}/{category}/{file}.[po|mo]
(translations/en-GB/LC_MESSAGES/commands.po
)
- localization_unsupported(_: str) NoReturn [source]¶
Default localization provider. Functions to disable the ability to localize commands and options. If you want to use localized commands in your application you should specify a different built-in or custom localization provider.
- Raises:
LocalizationFailedException – Whenever called. This means that when the client attempts to register commands with discord it will cause this error to be thrown if any of the commands (or options) are marked as requiring localization.