When a click event is triggered, I am able to change the language in vue-i18n. However, I am facing an issue with changing the vee-validate dictionary to match the same language.
Main.js
import VeeValidate from 'vee-validate'
import validations from './validations.js'
import i18n from './lang'
Vue.use(VeeValidate)
new Vue({
router,
store,
i18n,
render: h => h(App)
}).$mount('#app')
In the vue-i18n folder within lang/index.js
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import en from './locals/en'
import es from './locals/es'
Vue.use(VueI18n)
export default new VueI18n({
locale: 'en',
messages: {
en: {
lang: en
},
es: {
lang: es
}
}
})
In the vee-validate folder within src/validations.js
import {Validator} from 'vee-validate'
const dictionary = {
en: {
custom: {
signupEmail: {
required: 'Error',
},
}
},
es: {
custom: {
signupEmail: {
required: 'Hubo un error',
},
}
}
}
Validator.localize(dictionary)
const validator = new Validator()
validator.localize('en')
export default Validator
I am attempting to change the validator.localize('en') to the es dictionary without success, even when manually setting it with validator.localize('es'). Any suggestions on what I might be missing?