I am currently developing a Vue.js App (using Vite) where I have integrated Vee-validate with Yup for form validation, as well as i18n for message translation. However, I am experiencing an issue where the custom errors defined in the schema do not dynamically update when the user changes the locale using $i18n.locale='xx'
.
Here is the schema code snippet:
import { useI18n } from "vue-i18n"
const {t} = useI18n()
const schema = yup.object().shape({
username: yup
.string()
.required(t("field_required"))
.email(t("field_error_email")),
password: yup.string().required(t("field_required"))
})
It is worth mentioning that messages displayed directly in the template using $t("message")
function are functioning properly.
Below are the versions of the dependencies used:
"dependencies": {
"vee-validate": "^4.5.11",
"vue": "^3.2.33",
"vue-i18n": "^9.1.9",
"yup": "^0.32.11"
}