logaretm / vee-validate

✅ Painless Vue forms
https://vee-validate.logaretm.com/v4
MIT License
10.79k stars 1.26k forks source link

[V4] changing locale does not change currently generated validation error messages until resubmitting form #3876

Closed firibz closed 1 year ago

firibz commented 2 years ago

What happened?

I have a parent component (MainLayout) that contains my language switcher, and lots of Form components as children of the MainLayout component, when I switch the locale with setLocale(i18nLang);, the previously generated error messages on the Form component are not updating with it. Is there any way other than watching locale in every Form and calling formRef.value.validate(); after locale change? A global way?

sample project: https://github.com/firibz/vee-validate-change-locale

Screen Shot 2022-08-05 at 6 26 11 AM

Reproduction steps

1. 2. 3. ...

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/quasarframework-f65w2n?file=src/layouts/MainLayout.vue

Code of Conduct

logaretm commented 2 years ago

At the moment there is no other way, typically when a locale is changed you probably need to change a few things as well like the URL or the direction if it is RTL so I don't believe reactive languages support is a must-have.

I will tag this as an enhancement tho till I get around to doing it as I'm not sure how it would work in the current API.

Robo-Rin commented 8 months ago

@logaretm we have a global locale selector so the user can change the app locale on the fly. I would think that reactive localization is common given that vue-i18n also reactively changes the app locale.

But I know this was closed a while ago so was just wondering if there has been any additional thoughts or progress into this enhancement?

Thanks!