parameterize a resource bundle?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Eric_Cho
Posted On:   Thursday, January 19, 2006 07:58 PM

Hi all, Lets say I have to print out a string like: "There are 5 new users". The "5" is dynamically generated and the other words must be in a properties file to accomodate internationalization. so instead of having a resource bundle like: message_thereare = There are message_newusers = new users. then in the jsf:     Is it possible to have it parameterized like: message_newUsers = There are ? new users. then in the jsf: OR something like that? Any help would be   More>>

Hi all,



Lets say I have to print out a string like:

"There are 5 new users".

The "5" is dynamically generated and the other words must be in a properties file to accomodate internationalization.



so instead of having a resource bundle like:

message_thereare = There are

message_newusers = new users.




then in the jsf:



			
 

 






Is it possible to have it parameterized like:

message_newUsers = There are ? new users.




then in the jsf:





		



OR something like that? Any help would be appreciated.

Thanks,

Hasdy    <<Less

Re: parameterize a resource bundle?

Posted By:   Peter_Brewer  
Posted On:   Wednesday, March 22, 2006 11:16 AM

Hi Eric,


There is a built in JSF tag called h:outputFormat that will do the job.


In your resource bundle define something like:



message_userCount=There are {0,number,integer} new users.

In your jsf code you can then say:







The main docs for this are:


Re: parameterize a resource bundle?

Posted By:   ankush_purwar  
Posted On:   Friday, January 20, 2006 05:43 PM

Look at the class java.text.MessageFormat
About | Sitemap | Contact