# nuxt-i18n

> i18n for Nuxt

Latest version **6.28.1** (published 2021-08-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install nuxt-i18n
pnpm add nuxt-i18n
yarn add nuxt-i18n
bun add nuxt-i18n
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 6.28.1 |
| Published | 2021-08-03 |
| First published | 2017-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 82 KB |
| Known vulnerabilities | 0 (+5 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2086 |
| Maintainers | pi0, paulgv, rchl |

## Links

- npm: https://www.npmjs.com/package/nuxt-i18n
- Repository: https://github.com/nuxt-community/i18n-module
- Homepage: https://i18n.nuxtjs.org
- Issues: https://github.com/nuxt-community/i18n-module/issues
- npm.io page: https://npm.io/package/nuxt-i18n

## Dependencies (12)

- [ufo](https://npm.io/package/ufo.md) ^0.7.7
- [klona](https://npm.io/package/klona.md) ^2.0.4
- [cookie](https://npm.io/package/cookie.md) ^0.4.1
- [devalue](https://npm.io/package/devalue.md) ^2.0.1
- [is-https](https://npm.io/package/is-https.md) ^4.0.0
- [vue-i18n](https://npm.io/package/vue-i18n.md) ^8.25.0
- [js-cookie](https://npm.io/package/js-cookie.md) ^3.0.0
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.2
- [@babel/parser](https://npm.io/package/@babel/parser.md) ^7.14.9
- [@babel/traverse](https://npm.io/package/@babel/traverse.md) ^7.14.9
- [@intlify/vue-i18n-loader](https://npm.io/package/@intlify/vue-i18n-loader.md) ^1.1.0
- [@intlify/vue-i18n-extensions](https://npm.io/package/@intlify/vue-i18n-extensions.md) ^1.0.2

## Recent versions

- 6.28.1 (latest) — 2021-08-03
- 6.13.0-beta.0 (beta) — 2020-06-03
- 6.0.0-0 (prerelease) — 2019-07-01
- 6.28.0 — 2021-07-25
- 6.27.3 — 2021-07-09
- 6.27.2 — 2021-06-23
- 6.27.1 — 2021-06-15
- 6.27.0 — 2021-05-07
- 6.26.0 — 2021-04-20
- 6.25.0 — 2021-04-13
- 6.24.0 — 2021-04-09
- 6.23.0 — 2021-04-07
- 6.22.3 — 2021-03-30
- 6.22.2 — 2021-03-26
- 6.22.1 — 2021-03-25
- … 152 more at https://npm.io/package/nuxt-i18n/versions

## README

<p align="center">
  <img src="./docs/static/preview.png" alt="nuxt-i18n logo">
</p>

[![](https://david-dm.org/nuxt-community/i18n-module/status.svg?style=flat-square)](https://david-dm.org/nuxt-community/i18n-module)
[![](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](https://standardjs.com)
[![](https://img.shields.io/codecov/c/github/nuxt-community/i18n-module.svg?style=flat-square)](https://codecov.io/gh/nuxt-community/i18n-module)
[![](https://snyk.io/test/github/nuxt-community/i18n-module/badge.svg?style=flat-square)](https://snyk.io/test/github/nuxt-community/i18n-module)
[![](https://img.shields.io/npm/v/nuxt-i18n/latest.svg?style=flat-square)](https://npmjs.com/package/nuxt-i18n)
[![](https://img.shields.io/npm/dt/nuxt-i18n.svg?style=flat-square)](https://npmjs.com/package/nuxt-i18n)

> i18n for your Nuxt project

## Links
- 📘 [Documentation](https://i18n.nuxtjs.org/)
- 🔖 [Release notes](./CHANGELOG.md)
- 👥 [Community](https://discord.nuxtjs.org/)


## Features
- Integration with [vue-i18n](https://kazupon.github.io/vue-i18n/)
- Automatic routes generation and custom paths
- Search Engine Optimization
- Lazy-loading of translation messages
- Redirection based on auto-detected language
- Different domain names for different languages
- Storing current locale and messages with [Vuex](https://vuex.vuejs.org/)

## Setup
```sh
yarn add nuxt-i18n # yarn
npm i nuxt-i18n # npm
```

## Basic usage
Firstly, you need to add `nuxt-i18n` to your Nuxt config.

```javascript
// nuxt.config.js

{
  modules: [
    [
      'nuxt-i18n',
      {
        locales: ['en', 'es'],
        defaultLocale: 'en',
        vueI18n: {
          fallbackLocale: 'en',
          messages: {
            en: {
              greeting: 'Hello world!'
            },
            es: {
              greeting: '¡Hola mundo!'
            }
          }
        }
      }
    ]
  ]
}
```

Then you can start using `nuxt-i18n` in your Vue components!

```html
<template>
  <main>
    <h1>{{ $t('greeting') }}</h1>

    <nuxt-link
      v-if="$i18n.locale !== 'en'"
      :to="switchLocalePath('en')"
    >
      English
    </nuxt-link>

    <nuxt-link
      v-if="$i18n.locale !== 'es'"
      :to="switchLocalePath('es')"
    >
      Español
    </nuxt-link>
  </main>
</template>
```

If you would like to find out more about how to use `nuxt-i18n`, [check out the docs](https://i18n.nuxtjs.org/)!

## Issues, questions & requests

If you have any questions or issues, check out [Discord server](https://discord.nuxtjs.org).

## License

[MIT License](./LICENSE) - Copyright (c) Nuxt Community

---
_Source: https://npm.io/package/nuxt-i18n · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
