I18N is an integral part of the Bean validation specification.
By default, messages are retrieved from a resource set named "ValidationMessages". Therefore, simply specify this package (for example, ValidationMessages.properties) for the language (s) that you need to override the default messages from Hibernate Validator (which are extracted from the package "org.hibernate.validator.ValidationMessages").
In addition to the languages ββyou mentioned, Hibernate Validator 4.2 will provide Chinese ( HV-359 ) and Spanish ( HV-483 ).
If you do not want to work with file-based file packages at all, you can also provide your own MessageInterpolator or ResourceBundleLocator .
Using the Hibernate Validator PlatformResourceBundleLocator , it is also possible to use packages with names other than "ValidationMessages", like this:
Validation .byProvider(HibernateValidator.class) .configure() .messageInterpolator( new ResourceBundleMessageInterpolator( new PlatformResourceBundleLocator("com.mycompany.Messages"))) .buildValidatorFactory() .getValidator();`
source share