-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Changing language in message errors
PostPosted: Sun Jun 19, 2011 12:37 pm 
Newbie

Joined: Sun Jun 19, 2011 12:30 pm
Posts: 2
Hi, im using hibernate-validator-4.0.2.GA and im getting my bean errors always in english. I have added "ValidationMessages_es.properties" in org.hibernate.validator for supporting spanish messages.

In JSF2, when i want to change the language i use <FacesContext.getCurrentInstance().getViewRoot().setLocale(new Locale("es"));>. How can i do something like that for hibernate validator?.

Thanks.


Top
 Profile  
 
 Post subject: Re: Changing language in message errors
PostPosted: Sun Jun 19, 2011 4:29 pm 
Contributor
Contributor

Joined: Mon Feb 28, 2011 7:27 pm
Posts: 20
Location: France
Hi,

Is it possible to have more informations. What's your default locale (en, es)? In which context you use Hibernate Validator?

Maybe you already know this but you can change the default locale via the command line (launching application) with -Duser.language=xx or by calling the method Locale.setDefault("xx") inside your program.

You can find how message interpolation is done here http://docs.jboss.org/hibernate/validat ... erpolation

Hope this help.

--Kevin


Top
 Profile  
 
 Post subject: Re: Changing language in message errors
PostPosted: Mon Jun 20, 2011 3:19 am 
Newbie

Joined: Sun Jun 19, 2011 12:30 pm
Posts: 2
Thanks kevinpollet, the method Locale.setDefault("xx") is what i was looking for.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.