-
Notifications
You must be signed in to change notification settings - Fork 62
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
Cannot read property 'hasOwnProperty' of undefined #17
Comments
Hi there, Thank you for your question. The problem might be due to the fact, that I forgot to update the npm package to the latest version - for which the readme describes the setup. You still need to register the i18n module when initializing the store in the current npm version. Please register the module as follows:
Please let me know if this solves the problem. |
Thank you for the quick answer! Should I just download the source and use it directly? I got it working this way however I'm probably not doing it correctly: Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
i18n: vuexI18n.store
}
})
Vue.use(vuexI18n.plugin, store)
const translationsEn = {
"content": "This is some {type} content"
}
const translationsDe = {
"My nice title": "Ein schöner Titel",
"content": "Dies ist ein toller Inhalt"
}
Vue.i18n.add('en', translationsEn)
Vue.i18n.add('de', translationsDe)
Vue.i18n.set('en')
export default store |
You could use the source from the repo directly, I will however update the npm package probably later today. The only difference is the initialization of the module. Your code looks good to me. Vuex uses one "giant" object as state tree and the vuex-i18n plugin only adds a specific i18n property to store the translation to the state tree and provides some convenience functions to access the translations. |
Alright, thank you for all your help! I will wait until the package is updated. |
Hey, I'm new to Vue/Vuex and I'm trying to use this but I'm having some issues.
I'm loading Vuex in a separate directory/file from my main app.js like so:
And in my main app.js
This throws a
Uncaught TypeError: Cannot read property 'hasOwnProperty' of undefined
error. Any ideas on how I can make this work?The text was updated successfully, but these errors were encountered: