aspose file tools
The moose likes Java in General and the fly likes resource bundle properties file referencing key from value Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "resource bundle properties file referencing key from value" Watch "resource bundle properties file referencing key from value" New topic
Author

resource bundle properties file referencing key from value

kumar chandrakar
Greenhorn

Joined: Dec 23, 2008
Posts: 3
I have say message.properties as follows

label.productName = MyProduct
label.companyName = MyCompany
label.header = MyCompany-MyProduct
label.title = MyCompany-MyProduct
label.footer = MyCompany 2005-2008 All rights reserved

As you can see I have same words repeated in most of the labels.
Is there any way to avoid it by using keys "label.productName" and "label.companyName" with other values like..

label.productName = MyProduct
label.companyName = MyCompany
label.header = {label.productName}-{label.companyName}
label.title = {label.productName}-{label.companyName}
label.footer = {label.companyName} 2005-2008 All rights reserved

Can resource bundle recognize it if my values contain/references other keys defined in same properties file.
Alexey Saenko
Greenhorn

Joined: Aug 18, 2008
Posts: 25
Hi Kumar,
As far as I know, you cannot use for defining entries in property file other entries from the same file. But you can generate all values you need in your code, it looks like such solution is not difficult ;-)


SCJP 6, SCBCD 5, OCEWSD 6
My blog: http://darkleden.wordpress.com
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: resource bundle properties file referencing key from value
 
Similar Threads
about resource bundle
Configuration files - Best Practice?
how to .properties file
how can i get the path from which resource bundle gets its bundle file
Getting values from properties in validate-using multiple message-resources in struts