Skip to content

Yup i18n #777

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Yup i18n #777

wants to merge 10 commits into from

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