添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
  • 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 Setup
    yarn add nuxt-i18n # yarn
    npm i nuxt-i18n # npm
    Basic usage

    Firstly, you need to add nuxt-i18n to your Nuxt config.

    // 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!

    <template>
        <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!

    Issues, questions & requests

    If you have any questions or issues, check out Discord server.

    License
  •