parameterize resource file strings
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Eric_Cho
Posted On:   Friday, January 20, 2006 11:39 AM

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   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 resource file strings

Posted By:   Anonymous  
Posted On:   Thursday, March 9, 2006 02:30 AM

U ahve to create ur resource bundle entry like this

message_newUsers = There are {0} new users.

and u have to use MessageFormat class and make the call like


String[] number = new {"5" }

String msg = MessageFormat.format(message_newUsers , number);

About | Sitemap | Contact