This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I am implementing internationalization in my appliction.it should support 4 languages so i am wtriting 4 property files. that property file specification iam doing in my struts_config.xml when i do that it will take only last property file entrys.my property file specificatiopn as follows. what to do to take all entries of property file.
You can only specify one message resource without a key attribute. All others must have a key attribute.
It's also important to understand that you only need to define the base bundle name. You do not need to define a separate bundle for each language. Even though you have both a TRIMSLabelResources.properties file and a TRIMSLabelResources_it.properties file, you only need to define TRIMSLabelResources in the struts-config.xml file. Struts will automatically find the file with the correct language suffix.
Hi Rajani, What Merrill has pointed out, is that there has to be a key for all the Properties file. Only one can be left without a key. For your example..They need to be given if you have differnt .properties files.
In case you want i18n, you need to give only the default file name and the others would be found by Struts for the reqisuite language. Struts-config. <message-resources parameter="com.abc.efg.TRIMSMessageResources" /> You dont have to define.TRIMSMessageResources_fr, TRIMSMessageResources_sp for that. Hope it is clear.
Only the base name (TRIMSLabelResources) should be defined here, and not language specific names (TRIMSLabelResources_it). I don't know how to explain it any more clearly than that.
Joined: Nov 08, 2006
i got it. but one doubt other property files which we are writting for other language it should be their is it . but only thing is we will not specify in property file.
one morething want to ask, write now what i am doing is changing language in the internet explorer then my application will change to corresponding language. what i want to do is without internet explorer settings (In IE let it be default language)i want to set my language from program, that language should come how to do that.
Joined: Feb 15, 2005
Yes, I think you have the concept. You have multiple .properties files with language-specific suffixes (_en, _it, _es, _fr, etc.) but you only have one entry in the struts-config.xml file.
As for your question about how to dynamically set the language, see my response in this thread.