UserLocaleProvider

@InterfacedService(acceptMultiple = false)
interface UserLocaleProvider(source)

Provides the locale of a user in a Discord interaction, may be useful if the user has set its own locale, for example.

It is recommended to override both getDiscordLocale and getLocale for best results, when using localization in events, and in AppLocalizationContext.

This returns Interaction.getUserLocale by default.

Usage

Register your instance as a service with @BService or any annotation that enables your class for dependency injection.

See also

Functions

Link copied to clipboard
abstract fun getDiscordLocale(interaction: Interaction): DiscordLocale
Link copied to clipboard
open fun getLocale(interaction: Interaction): Locale