I try to override the default Hibernate Validator messages without success though. I am already using a resource bundle for several text which works pretty fine. The problem is with the messages of the Validator.
In detail:
I have created the following file: ValidationMessages_de.properties and placed it under \src\main\resources\translations\ValidationMessages_de.properties . The file has following resources: org.hibernate.validator.constraints.NotBlank.message=Value is required. org.hibernate.validator.constraints.NotEmpty.message=Value is required.
My faces-config.xml has following content:
<application>
<locale-config>
<default-locale>de</default-locale>
<supported-locale>de</supported-locale>
</locale-config>
<resource-bundle>
<base-name>translations.messages</base-name>
<var>msg</var>
</resource-bundle>
<resource-bundle>
<base-name>translations.ValidationMessages</base-name>
<var>validMsgs</var>
</resource-bundle>
<message-bundle>
translations.ValidationMessages
</message-bundle>
</application>
For validation I am using the following annotations: @NotEmpty @NotBlank
I tried also following:
None of the above solves the problem. When validating, Hibernate gives me the default message for the German locale : darf nicht leer sein
What am I missing ?
Although i had configured my faces-config.xml to look in the translations for some reasons it was unable to read from the the resources.
Once i moved the files under src\main\resources\ everything started to work.