LocalizableInteraction

Allows you to configure the localization settings of this interaction event, retrieve a LocalizableInteractionHook, as well as retrieve a localization context from it.

Always combined with LocalizableReplyCallback and/or LocalizableEditCallback.

Configuring localization bundle and prefix

You can change the bundle and prefix in the first lines of your interaction handler, with localizationBundle and localizationPrefix.

Configuring the user / guild locale source

They are by default retrieved from the interaction, but you can get them in other ways by implementing UserLocaleProvider and/or GuildLocaleProvider.

See also

Inheritors

Properties

Link copied to clipboard
abstract var localizationBundle: String?

If set, forces the specified localization bundle to be used.

Link copied to clipboard
abstract var localizationPrefix: String?

If set, adds the specified prefix to the path of every localization call, useful to avoid using very long strings in every reply/edit.

Functions

Link copied to clipboard

Retrieves a DefaultMessages instance, using a locale suitable for messages sent to the user.

Link copied to clipboard
abstract fun getGuildMessage(localizationPath: String, vararg entries: Localization.Entry): String

Returns the localized message at the following path, using the guild's locale and parameters.

Link copied to clipboard
fun LocalizableInteraction.getGuildMessage(localizationPath: String, vararg entries: PairEntry): String
Link copied to clipboard
Link copied to clipboard
abstract override fun getLocalizationContext(bundleName: String, pathPrefix: String?): AppLocalizationContext

Returns a localization context for the provided bundle name and path prefix, using the locales from UserLocaleProvider.getDiscordLocale and GuildLocaleProvider.getDiscordLocale.

Link copied to clipboard
abstract fun getLocalizedMessage(locale: Locale, localizationPath: String, vararg entries: Localization.Entry): String
open fun getLocalizedMessage(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): String

Returns the localized message at the following path, using the provided locale and parameters.

Link copied to clipboard
fun LocalizableAction.getLocalizedMessage(locale: Locale, localizationPath: String, vararg entries: PairEntry): String
fun LocalizableAction.getLocalizedMessage(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry): String
Link copied to clipboard
abstract fun getUserMessage(localizationPath: String, vararg entries: Localization.Entry): String

Returns the localized message at the following path, using the user's locale and parameters.

Link copied to clipboard
fun LocalizableInteraction.getUserMessage(localizationPath: String, vararg entries: PairEntry): String