-
Notifications
You must be signed in to change notification settings - Fork 56
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
multi projects vuex-i18n #97
Comments
Hi @nunob87 Thank you for reporting your issue. The problem arises due to the way that the i18n methods are registered on the vue instance. When you run As the vuexi18nPlugin is not registered on the vue instance in the parent project, any call to those methods will fail. Thus the error message You should be able to alleviate the problem by registering the plugin also on the parent directory. However, be advised, that the plugin will create a new vuex module on the state that you pass on plugin registration. The vuex-stores in your child projects will thus probably each get their own i18n-vuex-module. Calling the method |
By the way. You could directly dispatch vuex actions to change the i18n store settings from other vuex modules. actions: {
doSomething({dispatch}, payload) {
let lang = 'pt';
dispatch('i18n/setLocale', lang, {root:true});
}
}
// available actions are
i18n/setLocale
i18n/addLocale
i18n/replaceLocale
i18n/removeLocale
i18n/setFallbackLocale This way you would not need to register the i18n plugin on the parent. |
hello, I have several projects in which they will read the store for other projects, but those outside the project give me immense errors in translation.
in the main project the translation works and has no errors, in the secondary, it does not work
code:
// in a directory of a subproject
store.js
// parent project directory
mutations.js
// errors
The text was updated successfully, but these errors were encountered: