npm
Source
DeprecatedThis package has been replaced by
@wolfstar/plugin-i18next. No further releases are planned. See the migration guide.[!WARNING] This package is deprecated. It has been replaced byAn internationalization layer powered by@wolfstar/plugin-i18next, an official plugin for@wolfstar/http-frameworkliving inwolfstar-project/plugins. No further releases are planned here; please migrate — see Migration below, or the full migration guide.
i18next and @wolfstar/i18next-backend for @wolfstar/http-framework.
Usage
Initialization
Note: If you want to customize the options, please check i18next’s TypeScript guide to improve the experience.
Definition
Generate type augmentations with@wolfstar/i18next-type-generator:
Consumption
Migration
@wolfstar/plugin-i18next drops this package’s T/FT branded-key helpers in favour of i18next’s native
TypeScript support: keys are plain strings, typed via a generated declare module 'i18next' augmentation
(the same approach this package already uses via @wolfstar/i18next-type-generator).
It also replaces the manual load() + init() bootstrap with the @wolfstar/http-framework plugin lifecycle
and moves the loaded state onto container.i18n.
Bootstrap
preLoad hook awaits container.i18n.init() before the stores load, so command builders can still be
localized at registration time.
Keys and resolution
TFunction instead, exactly like getT did before:
Exports
getSupportedLanguageName, getSupportedUserLanguageName, getSupportedLanguageT, getSupportedUserLanguageT,
supportedLanguages, isSupportedDiscordLocale, getLocalizedData, applyNameLocalizedBuilder,
applyDescriptionLocalizedBuilder, applyLocalizedBuilder and createSelectMenuChoiceName keep the same names —
only the module specifier changes (and getSupportedLanguageT/getSupportedUserLanguageT gain the direct
(target, key, options) overload shown above).
The plugin also adds fetchLanguage / fetchT / fetchKey (asynchronous helpers honouring a custom
container.i18n.fetchLanguage hook), createLocalizedChoice, and chokidar-based hot reloading.
Other changes
- Requires
@wolfstar/http-framework@^3.1.0as a peer dependency. - Bumps
i18nextfrom^22to^25; see the i18next migration notes. - The locales directory defaults to
<root>/languagesinstead of an explicit path passed toload(). The layout — one directory per language, every nested.jsonfile a namespace — is unchanged.