Reputation: 292
I have a web application built in a single language and I would like to internationalize it by adding a few more languages. I would like to do it using a properties file containing keys and values (keys like 'name' and the value of this key changes in each properties file) . I read some time ago that there were an application that was capable of extract the labels from the jsp files and generate the properties file which the keys. Can someone tell me what would the best way to do this?
Thank you.
Upvotes: 2
Views: 1644
Reputation: 2168
Try using ResourceBundle. Say you have your localized property files called Resources_EN.properties, Resources_FR.properties, etc. You have to put your property files in the classpath. To get a localized string you do the following:
ResourceBundle resourceBundle = ResourceBundle.getBundle("Resources", new Locale("EN");
String value = resourceBundle.getString("myKey");
Upvotes: 1
Reputation: 6617
step 1 : use properties file for every language you want
step 2 : in all your view pages dont give static values but pick from language properties file
you can also refer this link as per your comfort
Upvotes: 1
Reputation: 691
Is that web application used Struts? If yes. It very easy to change the code. You have to change the Web.xml for I18N and jsps to get the property file according to language.
Upvotes: 0