Getting Started

Installation

Get started with Nuxt i18n module.

You are reading the v8 documentation compatible with Nuxt 3.
Checkout v7 Docs for Nuxt 2 compatible version.
Nuxt i18n module is using Vue i18n v9. See Vue i18n docs for more.

Quick Start

  1. Install @nuxtjs/i18n as a dev dependency to your project:
npx nuxi@latest module add i18n
  1. Add @nuxtjs/i18n to your nuxt.config modules:
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxtjs/i18n']
})

Module Options

You can set the module options by using the i18n property in nuxt.config root.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxtjs/i18n'],
  i18n: {
    // Module Options
  }
})

Alternatively, You can pass an array of the module name and the options object to modules

nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    [
      '@nuxtjs/i18n',
      {
        // Module Options
      }
    ]
  ]
})

Edge Channel

Opting in

You can opt in to the latest commits on the main branch to avoid waiting for the next release and helping the module by beta testing changes.

Update @nuxtjs/i18n dependency in your package.json:

package.json
{
  "devDependencies": {
-   "@nuxtjs/i18n": "^8.0.0"
+   "@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge"
  }
}

Then remove your lockfile and reinstall the dependencies.

Opting out

Update @nuxtjs/i18n dependency in your package.json:

package.json
{
  "devDependencies": {
-   "@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge"
+   "@nuxtjs/i18n": "^8.0.0"
  }
}

Then remove your lockfile and reinstall the dependencies.


Copyright © 2024