this.$i18n.locales is undefined when using yaml-loader
See original GitHub issueVersion
Reproduction link
https://github.com/jovanmaric/nuxti18n-yaml
Steps to reproduce
- Start with
yarn dev
. - Open console to see
this.$i18n.locales
outputting an array - Stop server
- Uncomment the build configuration in nuxt.config.js
- Start with
yarn dev
- Open console to see
undefined
What is expected ?
That this.$i18n.locales
returns the locales array even when using <i18n> component tags.
What is actually happening?
It seems like either vue-i18n-loader or yaml-loader are polluting the this.$i18n
namespace
Additional comments?
I’ve looked at the src, but im not sure how to fix this without side effects. this.i18n
seems to be where Vue-i18n is bound to by default, and nuxt-i18n extends on this behaviour.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10
Top Results From Across the Web
this.$i18n.locales is undefined when using yaml-loader #205
Start with yarn dev . Open console to see this.$i18n.locales outputting an array; Stop server; Uncomment the build configuration in nuxt.config.
Read more >nuxt-i18n: Lang Switcher Error "Object is possibly 'undefined'
I want to build a language switcher on my nuxt app with nuxt-i18n plugin. Important note is, that ...
Read more >Single file components | Vue I18n
If you are building Vue component or Vue application using single file components, you can manage the locale messages i18n custom block.
Read more >mini-i18n-extract-plugin - npm
Start using mini-i18n-extract-plugin in your project by running `npm ... To extract i18n files and split them by locales, add the loader and ......
Read more >cannot read properties of undefined (reading 'data') axios
I need to post some form data to a mockapi endpoint, using Axios and Vuex. I'm using Vue Cli v2, and Vuex 3....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a temporary workaround I add these lines in a
beforeMount
function in the components where I need locales or switchLocalePath:I’m facing the same issue:
It does not matter if it’s YAML or JSON.
I don’t know if this bug should be nuxt-i18n responsability or vue-i18n responsability, but there is a bug.