-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
Change error massage param to function #136
Conversation
✅ Deploy Preview for valibot ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thank you very much! Do you have an opinion on this issue? #36 |
Yes, sure. See. const LoginSchema = object({
email: string([
minLength(1, () => i18n["min_length"]),
email(() => i18n["email_fail"]),
])
}); |
Just wanted to comment, that looks pretty good for localization. |
I haven't made a decision about i18n yet. If you have a clear opinion, feel free to tell more about why this solution is better than the other ones in #36. |
My solution is more universal and is not tied to the i18n library |
Is there anyone who agrees that passing messages or functions to every validation function is inconvenient as I do? |
@thundermiracle are you interested in a global solution to pass individual error messages? |
Yes, of course. What's the solution? |
There are several ideas in issue #36. Which one do you prefer? |
I'm not sure. But
What about record map which support both string and function which others suggested? Maybe we should discuss it in #36 ? |
Yes, please share your ideas and feedback there. I plan to work on an implementation next week. |
Thanks again for creating this PR. Since I would do some basic things differently and it was faster for me to implement them directly, I made the changes independently. However, I have added you as a co-author and linked the PR in the changelog. |
Co-authored-by: PromiSe#### <vicimpa@users.noreply.github.com>
For multi language. Example: