[hibernate-issues] [Hibernate-JIRA] Commented: (HV-44) Make Hibernate Validator multi-lingual

Hayo Schmidt (JIRA) noreply at atlassian.com
Tue Dec 4 10:10:56 EST 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-44?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29046 ] 

Hayo Schmidt commented on HV-44:
--------------------------------

I would like to emphasize the need for a resolution to this topic. The requirement to set the language in hibernate validator has been put on me.

There should be a new constructor:
  public ClassValidator(Class<T> beanClass, Locale locale)

Also there is another bug with setting the language:
  new ClassValidator<ModAssignBean>( myBean.class, ResourceBundle.getBundle("org.hibernate.validator.resources.DefaultValidatorMessages", Locale.ENGLISH) ); 
should load the english resource bundle from the delivered set of resources. It does not, because there is no english resource DefaultValidatorMessages_en.properties in the library. The default is in english, but you cannot load it, unless you are on an english system.

A workaround for this is copying DefaultValidatorMessages.properties to another place as ValidatorMessages_en.properties and the load the resource from there. But you have to check this file on every update of hibernate-validator, which is a potential cause for bugs.


> Make Hibernate Validator multi-lingual
> --------------------------------------
>
>                 Key: HV-44
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-44
>             Project: Hibernate Validator
>          Issue Type: Improvement
>    Affects Versions: 3.0.0.ga
>            Reporter: Olle Hallin
>
> Hibernate Validator 3.0.0 is unfortunately useless in a multi-lingual web app, since it uses Locale.getDefault() for locating the validation message bundle.
> Each and every HTTP request can have a different locale, in it's own thread.
> Please add something in line with Spring's LocaleContextHolder (a ThreadLocal), which can be set early in the request handling chain. If not set, it could fall back to the platform's Locale.getDefault().

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list