vee-validate icon indicating copy to clipboard operation
vee-validate copied to clipboard

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

Open firibz opened this issue 3 years ago • 1 comments

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

...

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • [ ] Firefox
  • [ ] Chrome
  • [ ] Safari
  • [ ] Microsoft Edge

Relevant log output

No response

Demo link

https://stackblitz.com/edit/quasarframework-f65w2n?file=src/layouts/MainLayout.vue

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

firibz avatar Aug 05 '22 04:08 firibz

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.

logaretm avatar Aug 07 '22 01:08 logaretm

@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!

Robo-Rin avatar Feb 16 '24 23:02 Robo-Rin