Setup

Check the Nuxt.js documentation for more information about installing and using modules in Nuxt.js.

Add @nuxtjs/i18n dependency to your project:

yarn add @nuxtjs/i18n
npm install @nuxtjs/i18n

Then, add @nuxtjs/i18n to the modules section of your nuxt.config.js. You can use either of the following ways to specify the module options:

nuxt.config.js
{
  modules: [
    '@nuxtjs/i18n',
  ],
  i18n: {},
}

or

nuxt.config.js
{
  modules: [
    [
      '@nuxtjs/i18n',
      { /* module options */ }
    ]
  ],
}

Typescript

If using typescript or running typescript language server to check the code (for example through Vetur), add types to types array in your tsconfig.json:

tsconfig.json
{
  "compilerOptions": {
    "types": [
      "@nuxt/types",
      "@nuxtjs/i18n",
    ]
  }
}
Edit this page on GitHub Updated at Wed, Aug 4, 2021