| Author |
Internationalization
|
rajani arjun
Greenhorn
Joined: Nov 08, 2006
Posts: 8
|
|
Hi, 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. <message-resources parameter="com.trims.resources.TRIMSMessageResources"/> <message-resources key="label" parameter="com.trims.resources.TRIMSLabelResources"/> <message-resources key="message" parameter="com.trims.resources.TRIMSMessageResources"/> <message-resources key="image" parameter="com.trims.resources.TRIMSImageResources"/> <message-resources parameter="com.trims.resources.TRIMSLabelResources_it"/>
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
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.
|
Merrill
Consultant, Sima Solutions
|
 |
rajani arjun
Greenhorn
Joined: Nov 08, 2006
Posts: 8
|
|
Hi, thank you for reply . but what your telling iam not getting can you tell me clearly with example.if possible attaching some lines of coding thankyou
|
 |
RoshaniG Gopal
Ranch Hand
Joined: May 15, 2006
Posts: 180
|
|
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. <message-resources parameter="com.trims.resources.TRIMSMessageResources"/> <message-resources key="label" parameter="com.trims.labels.TRIMSLabelLabels"/> <message-resources key="message" parameter="com.trims.messages.TRIMSMessageMessages"/> 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.
|
Regards,<br />Roshani
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
This link explains all this in more detail. What I'm trying to tell you is that you need to remove the following line from your struts-config.xml file. <message-resources parameter="com.trims.resources.TRIMSLabelResources_it"/> 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.
|
 |
rajani arjun
Greenhorn
Joined: Nov 08, 2006
Posts: 8
|
|
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.
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
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.
|
 |
Nyanas Kandhan
Ranch Hand
Joined: Jan 27, 2009
Posts: 35
|
|
For an example on Struts internationalization you can refer here.
Struts I18N using locale.
Struts Internationalization using browser settings.
regards
Struts Developer
|
regards,
Nyanaskandhan
|
 |
Krishnakumar Ramanathan
Greenhorn
Joined: Aug 04, 2008
Posts: 6
|
|
Hi if you still not able to apply internationalization, please feel free to email to this ID(krishnaathul@gmail.com). I will sent you you an example app
|
 |
 |
|
|
subject: Internationalization
|
|
|