i18next-vue is the official integration library for using the i18next internationalization framework with Vue 3 applications. It simplifies the process of translating content by providing a Vue plugin (`I18NextVue`) and a Composition API hook (`useTranslation`), along with global properties like `$t` and `$i18next` for easy access within components. The current stable version is 5.4.0, with regular updates that include performance improvements, bug fixes, and minor features, alongside occasional breaking changes for major version bumps (e.g., v3, v4, v5) to align with i18next or Vue ecosystem changes. It differentiates itself by offering robust TypeScript support and seamless reactivity for language switching and dynamic content, leveraging Vue's application context for broader compatibility, including Pinia stores.
npm install i18next-vueVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize i18next, integrate i18next-vue as a plugin, and use both the Composition API's `useTranslation` hook and the global `$t` function for translations. It also shows language switching and rich text interpolation with the `<i18next>` component.
Update your TypeScript declaration files to reflect the new `declare module 'vue'` pattern. Refer to the official migration guide for exact changes.
Remove the `i18nOptions` property from your `I18NextVue` plugin configuration. All i18next configuration should now be done directly on the `i18next` instance passed to the plugin.
Consult the migration guide from v2.x to v3.x on the i18next-vue documentation. This often involves adapting to new Composition API patterns and changes in plugin configuration.
Upgrade to i18next-vue v5.1.0 or newer. This version uses app-level `provide`/`inject` to ensure `useTranslation()` is available in `app.runWithContext()` contexts.
Upgrade to i18next-vue v5.2.0 or newer to benefit from improved TypeScript type inference for `$t` that suggests keys including those with prefixes.
Ensure you are on i18next-vue v5.0.0+ and that your TypeScript setup correctly includes the `declare module 'vue'` pattern as described in the v5 migration guide. Also, verify `app.use(I18NextVue, { i18next })` is correctly called.Make sure you call `app.use(I18NextVue, { i18next: yourInitializedI18nextInstance })` and that `yourInitializedI18nextInstance` is a properly configured i18next object.Ensure `useTranslation` is imported as a named export (`import { useTranslation } from 'i18next-vue'`) and used within a Vue 3 `setup()` function or Composition API component.The `<i18next>` component should be automatically available after `app.use(I18NextVue, { i18next })`. If still failing, ensure the plugin is applied correctly and Vue is picking up the component registration.