i am Vee-valdiate 4 with vue3,
i am trying to use load the translation for the defined custom rules and mix them with loaded translation from @vee-validate/i18n, i couldn’t find it in the docs,
customRulesTranslation.js:
import { localize } from '@vee-validate/i18n';
localize({
en: {
messages: {
PASSED: 'The passwords do not match',
},
},
de: {
messages: {
PASSED: 'Die Passwörter stimmen nicht überein',
},
},
customRules.js:
defineRule('PASSED', (value) => {
// Check if password field is empty
if (!value) {
return false;
}
// Check if value matches the email pattern and does not contain forbidden characters
if (!/(?=.*d)(?=.*[a-z])(?=.*[A-Z])|(?=.*d)(?=.*[a-z])(?=.*[^a-zA-Z0-9])|(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])/.test(value)) {
return 'The password field should contain at least a Number, a Special Character and an Uppercase Letter';
}
return true;
});
and i have this veevalidateInit:
import { localize, setLocale } from '@vee-validate/i18n';
import { configure } from 'vee-validate';
import './veeValidateCustomRulesTranslation';
export default {
methods: {
async setValidationTranslation(lang) {
const loadedTranslation = await import(`@vee-validate/i18n/dist/locale/${lang}.json`);
setLocale(lang);
configure({
generateMessage: localize({
[lang]: loadedTranslation,
}),
});
},
},
};
i am trying to find a way to mix the loaded translation with the defined rules translation