Kord Extensions Help

Internationalization (i18n)

The i18n builder allows you to configure how the bot should handle translations and other types of internationalization and localization. Kord Extensions supports a number of locales. You can find the current translation progress (or contribute your own translations) on Weblate.

ExtensibleBot(TOKEN) { // ... i18n { defaultLocale = SupportedLocales.SPANISH applicationCommandLocale(SupportedLocales.ALL_LOCALES_SET) interactionUserLocaleResolver() interactionGuildLocaleResolver() } }

Builders

Name

Parameters

Description

localeResolver

GuildBehavior? ChannelBehavior? UserBehavior? Interaction?

Register a locale resolver. Locale resolvers are callables that return a Locale object based on the parameters passed to it. For more information, see the i18n documentation.

translationsProvider

Locale

Register a callable object (usually a constructor) that returns an alternative implementation of the TranslationsProvider type.

Functions

Name

Parameters

Description

applicationCommandLocale

Collection / vararg:


Java Locale or Kord Locale

Registers the given locales as application command locales. These locales will be used to provide command name translations when they're being registered with Discord. Do not provide the defaultLocale, as it will be used automatically.

interactionGuildLocaleResolver

Registers a locale resolver (via localeResolver) which attempts to resolve locales using the current guild's server settings.

interactionUserLocaleResolver

Registers a locale resolver (via localeResolver) which attempts to resolve locales using the current user's Discord language setting.

Properties

Name

Type

Default

Description

defaultLocale

Locale

SupportedLocales.ENGLISH

The default Locale to fall back to if the configured locale resolvers don't return one, and to use as the default language when registering application commands.

Last modified: 03 September 2024