lightbulb.commands.utils¶
- async localize_name_and_description(name: str, description: str | None, default_locale: Locale, localization_provider: localization.LocalizationProvider) tuple[str, str, Mapping[Locale, str], Mapping[Locale, str]] [source]¶
Helper method to resolve the localizations for the name and description of a command using the given localization provider.
- Parameters:
name – The command’s name
description – The command’s description
default_locale – The default locale to use for the command.
localization_provider – The localization provider to use to get the available localizations for the command.
- Returns:
Tuple containing the resolved name, description and localizations for the name and description.
- async localize_value(value: str, default_locale: Locale, localization_provider: localization.LocalizationProvider) tuple[str, Mapping[Locale, str]] [source]¶
Get the value, and localized values for the given string, using the provided localization provider.
- Parameters:
value – The string to get the localized values for.
default_locale – The default locale to use.
localization_provider – The localization provider to use.
- Returns:
The string localized to the default locale, and a dictionary containing the localized values for all the remaining locales.