Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with message resources

 
shankar reddy
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have changed the brower language settings to other countries, i am not getting the required pages depending upon the languages changes. but i have observed that the .properties file present in the last is executing every time.

example:
<message-resources parameter="com/myapp/struts/ApplicationResource"/>
<message-resources parameter="com/myapp/struts/Application_fr"/>
<message-resources parameter="com/myapp/struts/Application_en"/>
<message-resources parameter="com/myapp/struts/Application_de"/>


so Application_de.properties file is executing ,
if i keep Application_fr.properties as the last line then the _fr.properties file is executing.

could any one help me.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've misunderstood how to define resource files. The name you define in the struts-config.xml file represents a bundle or group of files. The group is represented by a name without a language suffix. Struts will then append the appropriate language suffix when it determines which language the browser is set to use. So, your example, you should rename the file ApplicationResource.properties to Application.properties and change your struts-config.xml file so it has only the following entry for message resources:

Struts will then check the language of the browser and look for a file with the appropriate language suffix (e.g. Application_en.properties) and if it doesn't find that file it will use the default file of Application.properties.
 
shankar reddy
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone give the solution ...
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shankar reddy telukutla:
can anyone give the solution ...

It's a little disturbing that I spent my time posting an answer your question, and you don't even acknowledge that any response was given.

If you don't think this is the right solution, or you tried it and it didn't work, please let us know. It's a bit rude, though, to just pretend that no response was given.
 
prakash chauhan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay i dint know that the suffix for the country is added automatically..
now i might be asked to post it in a different thread but as the discussion is on , i just wanted to confirm do we have to have the .properties files along with other .class files?
and why is that so?
-Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic