-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Error message localization is not reactive (setLocale
, @vee-validate/i18n
, and vue-i18n
)
#4672
Comments
@logaretm hoping to escalate this if possible. Or if you can help point me in the right direction that you want to take this library then I might be able to work on this myself even. |
Same here. |
I am not even able to change the locale using setLocale. I tried to put it in the main.ts but changing the locale to 'de' seems to have no effect. Maybe someone can point me to the issue. Here is a demo: |
@blouflashdb If you consult the vee-validate localization guide, you can see that
There is a localization library for zod which you can use. I forked your StackBlitz demo and adjusted it to use that library. Note: changing the locale by calling |
What happened?
Error messages are not reactive to locale changes like they used to be in v2. We need this functionality because we have a global locale selector button that changes the app locale. When the form is dirty and they change the locale, we need to still show the validation error messages without resetting the validation state.
There was a similar closed issue: #3876 , but I don't agree with the conclusion that it's a rare scenario and our application needs this as per our product's requirements.
It would be ideal if there was a way to pass the reactive
locale
fromvue-i18n
or any source really and havevee-validate
watch that ref for changes, and when it changes it would switch locales. Currently, thesetLocale
function from@vee-validate/i18n
does not suffice.Reproduction steps
Install dependencies
dependencies:
@vee-validate/i18n
,@vee-validate/rules
,vue
,vue-i18n
,vee-validate
devDependencies:
@vitejs/plugin-vue
,typescript
,vite
,vue-tsc
main.ts
i18n.ts
App.vue
[...]
(For more app code, etc., see the Stackblitz demo)
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
Relevant log output
No response
Demo link
https://stackblitz.com/edit/vee-validate-issue-template-tg6i43?file=src%2FApp.vue
Code of Conduct
The text was updated successfully, but these errors were encountered: