-->
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: Translate field names on validation
PostPosted: Fri Aug 03, 2007 7:11 am 
Regular
Regular

Joined: Wed Oct 15, 2003 4:40 pm
Posts: 67
Hello and pardon my noobishness, but:

What is the most elegent way be to translate the field name also when validating?

if I have a field called "username" that can't be null then I can probably have a

Code:
validator.notNull=Can't be null. Nope.


and probably a

Code:
validator.notnull={propertyName} can't be null. Nope.


which would result in "username can't be null. Nope."

But how can you make a "second pass" through a resource bundle to translate the field name? Something like

Code:
validator.notnull=#{messages['{propertyName}']} can't be null. Nope.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 03, 2007 2:25 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
That's an interesting subject, we are looking into in in the 303 expert group. But if you expect to expose that to your GUI, I find it awkward to use the field name.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 03, 2007 3:14 pm 
Regular
Regular

Joined: Wed Oct 15, 2003 4:40 pm
Posts: 67
emmanuel wrote:
That's an interesting subject, we are looking into in in the 303 expert group. But if you expect to expose that to your GUI, I find it awkward to use the field name.


Yes, with all i18n and resource bundles, it is shame if that "username" haunts you through all the languages without a possibility to look it up somewhere.

It can probably be worked around by manually taking the field name from the InvalidValue and running it manually through some bundles but it would be nice to have some automation (and seam integration)


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.