Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting messages.properties dynamically

 
Fawad Ali
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I want to get the properties files dynamically for internationalization based on some conditions. How can I do that? Let me explain the scenario a bit. I have an application running different events. Each event has its own properties file for Spanish, Italian languages etc. If I place the properties files in /Events/{eventName}/messages.properties, then, is there any way in Struts to get the required properties file for a specific event dynamically at run time.

Thanks in advance.
 
Fawad Ali
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To explain more precisely. I have two events eventA and eventB. Both have different property files. If I want to visit an action named abc.action with eventA then the Struts tags should take the key, value pair for internationalization from a file at /Events/eventA/messages_fr.properties. If I want to visi the same action (abc.action) with eventB, then the properties file should be read from /Events/eventB/messages_fr.properties.

Basically I want to overwrite the Struts default path for Internationalization which is resources folder right now. Is it possible with Struts and struts tags or not?

BTW, I am using Struts 2.0.
 
Fawad Ali
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
Still no reply from anyone . I have, although, looked a bit into the tags and found that can be used to load a customProperties.properties file for internationalization. This is fine but I want the customProperties file name to be dynamic from action class. I am trying to do the following



But it wont load the properties file whose name is stored in the resourceBundle variable in the action class. Any idea how can I set the fileName from action class to this tag?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic