1

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

receptionContact=Reception
reservationContact=Reservation

receptionEmail={receptionContact}
reservationEmail={reservationContact}
Oh Chin Boon
  • 23,028
  • 51
  • 143
  • 215

1 Answers1

2

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
company.service.email=help@company.com
my.error.message=Problem accessing account!\
                 Please call customer service at 555-1212 \
                 or email us at help@company.com 

With:

company.service.phone=555-1212
company.service.email=help@company.com
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.

Robin
  • 8,162
  • 7
  • 56
  • 101
  • Yes. I've used this to learn how to use a custom resource bundle in jsf: http://www.andygibson.net/blog/article/resource-bundles-in-jsf-2-0-applications/ – Robin Nov 16 '11 at 17:03
  • Hi buddy, i think you might have gotten my question wrongly, i am trying to reuse text from the resource bundle itself. – Oh Chin Boon Nov 17 '11 at 01:15
  • @ChinBoon: actually he _is_ answering your question - but you need the library in https://code.google.com/p/reflectiveresourcebundle/ – Mr_and_Mrs_D Feb 09 '14 at 23:54