Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No nuxt-i18n properties when using i18n one file component translation #67

Closed
ghost opened this issue Apr 9, 2018 · 2 comments
Closed

Comments

@ghost
Copy link

ghost commented Apr 9, 2018

Version

v3.2.3

Reproduction link

https://github.com/nuxt-community/nuxt-i18n

Steps to reproduce

Using Nuxt 1.4.0 and Nuxt i18n 3.2.3, vue-i18n-loader 0.3.0

Config for the i18n module:

locales: [
          { code: 'en', iso: 'en-US', name: 'English' },
          { code: 'de', iso: 'de-DE', name: 'Deutsch' }
        ],
        seo: false,
        vueI18n: {
          fallbackLocale: 'en',
          silentTranslationWarn: true,
          messages: {
            en: require('./locales/en.json'),
            de: require('./locales/de.json')
          }
        }

Config for the build loader:

vendor: ['element-ui', '@fortawesome/vue-fontawesome'],
    /*
    ** Run ESLint on save
    */
    extend(config, { isDev, isClient }) {
      if (isDev && isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
        const vueLoader = config.module.rules.find(
          rule => rule.loader === 'vue-loader'
        )
        vueLoader.options.loaders['i18n'] = '@kazupon/vue-i18n-loader'
      }
    }

Component file:

<i18n>
...
</i18n>

<template>
  <div>
    {{ $i18n.locales }}
  </div>
</template>

What is expected ?

Output of the $i18n properties, in this case the locales.

What is actually happening?

No output of the locales. $i18n.locale print the locale.

Additional comments?

Without the <i18n>...</i18n in the component file the locales are printed.

This bug report is available on Nuxt.js community (#c59)
@ghost ghost added the cmty:bug-report label Apr 9, 2018
paulgv added a commit that referenced this issue Jun 7, 2018
This change prevents conflicts with vue-i18n features that also rely on an i18n key in components

BREAKING CHANGE: Pages using i18n key need to be updated to use nuxtI18n key instead

#94, #67
@karellm
Copy link

karellm commented Aug 2, 2018

I was wondering if there was any update on this front. I'm trying to use <i18n> for locale definitions too.

@ghost
Copy link

ghost commented Aug 8, 2018

This bug-report has been fixed by @paulgv in release v4.0.0.

This should be fixed in v4.0.0 where nuxt-i18n prototype key has been renamed from i18n to nuxtI18n to prevent conflicts with vue-i18n

@ghost ghost closed this as completed Aug 8, 2018
@ghost ghost added the cmty:status:fixed label Aug 8, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant