Skip to content

Conversation

Tristan-WorkGH
Copy link
Contributor

Yup validation system don't provide dynamic locale system. Only the setLocale global method and field-specific constraint(msg) exists.
The previous way of work to output react-intl key with setLocale isn't satisfying because we need to override all standard yup errors (partially done currently), and we need to catch yup error and pass them to react-intl ourself manually.
A new way found is to instead pass localized message to Yup during the schema construction. It's more simple to trace from were come the translations keys and we don't have to worry of yup output in components.
Bonus: Include yup-locales library to have French translations for native yup messages.

@Tristan-WorkGH Tristan-WorkGH self-assigned this May 22, 2025
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant