Skip to content
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

How can I change the default message? #7

Closed
benjamingb opened this issue Nov 29, 2020 · 1 comment
Closed

How can I change the default message? #7

benjamingb opened this issue Nov 29, 2020 · 1 comment
Labels
question Further information is requested

Comments

@benjamingb
Copy link

How can I customize the default message?
I want it to come out in another language

@haraldmaida
Copy link
Member

The payloads of the enum ContraintViolation have a field code. The idea of this field is, that it contains a predefined key that can be mapped to a user friendly message in any language. The codes that are used by the validations provided by this crate can be found in the module validation. The defined codes are the constants with names like INVALID_..... The translation of the messages and how to choose a users language is no scope of this crate. It should be possible to combine this crate with any lib that provides localization support.

@haraldmaida haraldmaida added the question Further information is requested label Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants