Closed michalkvasnicak closed 7 years ago
AFAIK Yup doesn't have a way of dealing with i18n. Thus, i would pick another validation library instead and pass its output to validate
.
@michalkvasnicak If you settle on a validation lib you like that supports i18n, would you mind leaving a comment here so I can make an example for the Formik documentation?
hey guys yup has support for i18n! https://github.com/jquense/yup#using-a-custom-locale-dictionary
I stand corrected ^^
Yes it has, but I didn't know that it supports functions in locale until yesterday's evening, so now this issue can be closed :)
For example, if we are using yup schema for validation in formik, it is easy to translate messages, but problem occurs when we are using
string().min()
and the error message should be correct for a given number inmin()
validator.Currently formik is adding error messages as a string, so it basically strips
params
fromyup.ValidationError
. In order to handle this, we have to somehow wrap all validators inyup
to custom validators, just to translate messages correctly.Is there a way how to handle this in formik?