| Author |
Getting messages.properties dynamically
|
Fawad Ali
Ranch Hand
Joined: Dec 28, 2009
Posts: 108
|
|
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.
|
Regards, Fawad Ali.
Software Engineer, Stafona Inc. - My Blog
|
 |
Fawad Ali
Ranch Hand
Joined: Dec 28, 2009
Posts: 108
|
|
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
Joined: Dec 28, 2009
Posts: 108
|
|
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?
|
 |
 |
|
|
subject: Getting messages.properties dynamically
|
|
|