-
Notifications
You must be signed in to change notification settings - Fork 7
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
setLocale not working #11
Comments
I've never looked into the |
Actually, i don't know much either. As i discovered this package a couple of days ago. But you hav to get somehow access to the following file. import { string as locale } from './locale'; Then you can check if here is a phone property like. def phone(countryCode, errorMess){
let message = errorMess ? errorMess : 'default error message'
if(!errorMess && local.phone){
message = local.phone
}
} So the main questions is how to get access to the local file of Yup. |
Take a look into this issue. The comment mentions how to import the locale, but it probably won't work out of the box in typescript, as the phone is included in the interface. (Probably thy would have to add a \ ts-ignore somewhere) But at least in javascript would work ;-) I also recommend following this issue, so you stay updated :-) |
we can now use |
Hey,
First, thanks for your really useful library!
Is it possible for to connect your phone function with the setLocale function from yup ?
With the set Locale function, i can change all the different languages on one place. But your phone function isn't working.
The native yup functions predefine the error message from the locale definition like:
length( length: number | Reference<number>, message: Message<{ length: number }> = locale.length, ) { .... }
source: https://github.com/jquense/yup/blob/master/src/string.ts
In your case, it is a hard coded string in English (or you change it explicitly when you call the phone function).
regards
Reocin
The text was updated successfully, but these errors were encountered: