Skip to main content

@sapphire/plugin-i18next

Classes

ClassDescription
InternationalizationHandlerA generalized class for handling i18next JSON files and their discovery.

Interfaces

InterfaceDescription
$DictionaryThis is a re-exported type from i18next. It is essentially an object of key-value pairs, where the key is a string and the value is any.
BuilderWithDescription-
BuilderWithName-
HMROptionsConfigure whether to use Hot-Module-Replacement (HMR) for your i18next resources using these options. The minimum config to enable HMR is to set enabled to true. Any other properties are optional.
I18nextFormatters-
I18nextNamedCachedFormatterRepresents a cached formatter that is added to i18next with i18next.services.formatter.addCached.
I18nextNamedFormatterRepresents a cached formatter that is added to i18next with i18next.services.formatter.add.
InternationalizationClientOptions-
InternationalizationContextContext for InternationalizationHandler.fetchLanguage functions. This context enables implementation of per-guild, per-channel, and per-user localization.
InternationalizationOptionsThe options used in InternationalizationHandler.
LocalizedData-
TFunction-

Type Aliases

Type aliasDescription
$SpecialObjectThis is a re-exported type from i18next. It is the returned type from resolveKey when returnObjects is true in the options.
BuilderWithNameAndDescription-
ChannelTarget-
DiscordChannel-
I18nextFormatterRepresents a formatter that is added to i18next with i18next.services.formatter.add or i18next.services.formatter.addCached, depending on the cached property.
TOptions-
Target-
TextBasedDiscordChannel-

Variables

VariableDescription
i18next-
versionThe @sapphire/plugin-i18next version that you are currently using. An example use of this is showing it of in a bot information command.

Functions

FunctionDescription
applyDescriptionLocalizedBuilderApplies the localized descriptions on the builder, calling setDescription and setDescriptionLocalizations.
applyLocalizedBuilderApplies the localized names and descriptions on the builder, calling applyNameLocalizedBuilder and applyDescriptionLocalizedBuilder.
applyNameLocalizedBuilderApplies the localized names on the builder, calling setName and setNameLocalizations.
createLocalizedChoiceConstructs an object that can be passed into setChoices for String or Number option with localized names.
fetchLanguageRetrieves the language name for a specific target, using InternationalizationHandler.fetchLanguage. If InternationalizationHandler.fetchLanguage is not defined or this function returns a nullish value, then there will be a series of fallback attempts in the following descending order: 1. Returns Guild.preferredLocale. 2. Returns InternationalizationOptions.defaultName if no guild was provided. 3. Returns 'en-US' if nothing else was found.
fetchTRetrieves the language-assigned function from i18next designated to a target's preferred language code.
getLocalizedDataGets the value and the localizations from a language key.
resolveKeyResolves a key and its parameters.