HJW
HJW

Reputation: 23443

Variable substitution JSF Resource Bundle property file

Can i do something like in JSF Resource Bundle property text file:

receptionContact=Reception
reservationContact=Reservation

receptionEmail={receptionContact}
reservationEmail={reservationContact}

Upvotes: 1

Views: 1652

Answers (1)

Robin
Robin

Reputation: 8498

You can parameterize your resource bundles, but no reflective reuse of values by keys. Please have a look on this: https://code.google.com/p/reflectiveresourcebundle/

With that, you don't have repeat your self!

Without:

company.service.phone=555-1212
[email protected]
my.error.message=Problem accessing account!\
                 Please call customer service at 555-1212 \
                 or email us at [email protected] 

With:

company.service.phone=555-1212
[email protected]
my.error.message=Problem accessing account!\
                 Please call customer service at ${company.service.phone} \
                 or email us at ${company.service.email}

Here is another interesting tutorial about formatting.

Upvotes: 2

Related Questions