Open dan-zx opened 7 years ago
Creating a spring bean with LocalValidatorFactoryBean and use ResourceBundleMessageSource to interpolate custom validation messages will translate correctly messages using the Accept-Language header but only for custom messages.
Default messages (hibernate validator) are not translated with this approach and always use the default locale.
It seems that when a custom interpolator is defined in a new Validation bean. This custom interpolator is only working with messages that are not part of org.hibernate.validator.ValidationMessages
Looks like Spring has something to do with this because in BaseValidationTest. Hibernate Validator is loading both the user messages and also the default messages. When a default message is rewritten in the user messages, user messages takes priority. This behavior is way different in the actual application run.