After going to a blog post from one of the Hibernate guys, and after he started working at the Validator Validator source, I think you get the idea:
public String getMessage(Locale locale, String key) {
String message = key;
key = key.toString().replace("{", "").replace("}", "");
PlatformResourceBundleLocator bundleLocator = new PlatformResourceBundleLocator(ResourceBundleMessageInterpolator.DEFAULT_VALIDATION_MESSAGES);
ResourceBundle resourceBundle = bundleLocator.getResourceBundle(locale);
try {
message = ResourceBundle.getString(key);
}
catch(MissingResourceException ) {
message = key;
}
return message;
}
, PlatformResourceBundleLocator . ResourceBundle . , . ; , , .
UPDATE
( ) - applicationContext.xml :
<bean id="resourceBundleSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>org.hibernate.validator.ValidationMessages</value>
</list>
</property>
</bean>
MessageSource , messageSource.getMessage(). , , .