does this library has support for custom setLocaly in yup
See original GitHub issueI tried to defined a custom setlocale for custom error messages, but always get the default ones defined in yup, I defined something like this, before my validation schema:
setLocale({
string: {
required: 'Requerido',
},
})
//schema
validationSchema: yup.object().shape({
password: yup.string().required(),
}),
The idea is define a global config error message to avoid doing the same in each validationschema like the example file:
validationSchema: Yup.object().shape({
email: Yup.string()
.email('Invalid email address')
.required('Email is required!'),
}),
Thank you this is an awesome Lib
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Yup - npm
Using a custom locale dictionary. Allows you to customize the default messages used by Yup, when no message is provided with a validation...
Read more >yup - npm.io
Yup is a JavaScript schema builder for value parsing and validation. ... If you need multi-language support, Yup has got you covered. The...
Read more >schema-to-yup - npm Package Health Analysis - Snyk
Build a Yup schema object to validate models from a domain model schema (JSON or ... This library is built to be easy...
Read more >How to customize yup validation messages? - Stack Overflow
You could do it by using setLocale function from yup like this: ... The section Using a custom locale dictionary is what you...
Read more >Dependency injection in action - Angular
A good example is a service that holds state for its companion component ... Angular starts with that component's injector and walks up...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just a heads up to @yanv1991, your code wasn’t working because there isn’t a
required
locale forstring
.You have to use
mixed
:with v0.23 (along with sync validation!) setting the locale is not import order dependent so should be a problem any more 😃