-
Notifications
You must be signed in to change notification settings - Fork 64
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
Provide an easier way to translate validations #754
Comments
I love the idea. I've thought about that too, and actually some of the validations are almost impossible to customize the error right now. Like avram/src/avram/validations.cr Lines 208 to 213 in c3df842
If you want to take a stab at a PR, that would be nice. |
Great! Yeah, I'll see how far I get with minimal impact. And also think of a way to add some kind of interpolation with min/max and customizability with the combinations, like |
I believe this is done now via #757 I'm going to close this, but if there's still more to do, we can re-open it. |
Yes, that one is done. Still working on this, though: luckyframework/lucky#1773. |
As it is currently, validation error messages are hardcoded. The only way to translate them is through the
message
argument, which results in a lot of repetition:How about creating an adapter to allow i18n libraries to hook into and overwrite Avram's default values? It could be a simple as:
And then allow the backend to be configured:
The above is all untested and from the top of my head. I'm open to suggestions. What do you guys think?
The text was updated successfully, but these errors were encountered: