@nuxtjs/i18n
i18n for Nuxt
Last updated 3 years ago by rchl .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @nuxtjs/i18n 
SYNC missed versions from official npm registry.

Check the next branch for Nuxt 3 support


@nuxtjs/i18n logo

i18n for your Nuxt project

Looking for Nuxt 3 compatible version?

Links

Features

  • Integration with 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

Setup

yarn add @nuxtjs/i18n # yarn
npm i @nuxtjs/i18n # npm

Basic usage

Firstly, you need to add @nuxtjs/i18n to your Nuxt config.

// nuxt.config.js

{
  modules: [
    [
      '@nuxtjs/i18n',
      {
        locales: ['en', 'es'],
        defaultLocale: 'en',
        vueI18n: {
          fallbackLocale: 'en',
          messages: {
            en: {
              greeting: 'Hello world!'
            },
            es: {
              greeting: '¡Hola mundo!'
            }
          }
        }
      }
    ]
  ]
}

Then you can start using @nuxtjs/i18n in your Vue components!

<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 @nuxtjs/i18n, check out the docs!

Issues, questions & requests

If you have any questions or issues, check out the #i18n channel on Discord server.

License

MIT License - Copyright (c) Nuxt Community

Current Tags

  • 7.3.1                                ...           latest (3 years ago)
  • 8.0.0-beta.12                                ...           next (3 years ago)

27 Versions

  • 8.0.0-beta.12                                ...           3 years ago
  • 8.0.0-beta.11                                ...           3 years ago
  • 8.0.0-beta.10                                ...           3 years ago
  • 8.0.0-beta.9                                ...           3 years ago
  • 8.0.0-beta.8                                ...           3 years ago
  • 7.3.1                                ...           3 years ago
  • 8.0.0-beta.7                                ...           3 years ago
  • 8.0.0-beta.6                                ...           3 years ago
  • 8.0.0-beta.5                                ...           3 years ago
  • 8.0.0-beta.4                                ...           3 years ago
  • 8.0.0-beta.3                                ...           3 years ago
  • 8.0.0-beta.2                                ...           3 years ago
  • 8.0.0-beta.1                                ...           3 years ago
  • 8.0.0-alpha.3                                ...           4 years ago
  • 8.0.0-alpha.2                                ...           4 years ago
  • 8.0.0-alpha.1                                ...           4 years ago
  • 7.3.0                                ...           4 years ago
  • 7.2.3                                ...           4 years ago
  • 7.2.2                                ...           4 years ago
  • 7.2.1                                ...           4 years ago
  • 7.2.0                                ...           4 years ago
  • 7.1.0                                ...           4 years ago
  • 7.0.3                                ...           5 years ago
  • 7.0.2                                ...           5 years ago
  • 7.0.1                                ...           5 years ago
  • 7.0.0                                ...           5 years ago
  • 0.0.0                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (13)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org | Home |