vee-validate: Vee-Validate locale change from EN to NL not working
Versions:
- VueJs: 2.1.10
- Vee-Validate: 2.0.0-beta.25
Description:
I’m building a app with Laravel 5.4 and Vue 2.1.10 Now i installed vee-validate 2.0 and everything seems to look fine, like validating except for my locale setting. I want the default EN change to NL (dutch language) but the validating error messages are still default English.
My configuration in my app.js:
import messages from '../../../node_modules/vee-validate/dist/locale/nl';
import Vue from 'vue';
import VeeValidate, { Validator } from 'vee-validate';
// Merge the locales.
Validator.updateDictionary({
nl: {
messages
}
});
const config = {
locale: 'nl',
};
Vue.use(VeeValidate, config);
The script i use on my page Really basic, my form is validating but shows the messages in English not in Dutch.
new Vue({
el: '#app',
locale : 'nl'
});
Steps To Reproduce:
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 15 (4 by maintainers)
It works for me on version
^2.1.0-beta.6
This setup works great on v: 2.0.0-beta.25! Thanks @logaretm
Sorry about that, few things has been changed since beta.24
The built locales actually export an object containing the locale name and the locale object, not the messages as it used to be, so you are going to do the following:
I will update the docs, thanks for the feedback
it is a
.js
file which looks like this (it’s not fully translated yet, I tested it withrequired
andemail
messages):For me, after trying everything, only this worked:
notice the call to
setLocale
. Without that, the messages would stay in English.add this way to document, otherwise it will make others feel unsure about that.
You can use webpack’s async modules using
import()
should split your app files and import them when needed, I can’t think of another way atm.@logaretm but that example is rather confusing, if you aren’t adding the
Vue.use()
part, then you should consider kamihouse’s approach instead.