Thanks for your reply. SessionAware and RequestAware seem to be specific to Struts 2. I forgot to mention that it is Struts 1.
My problem is this: I need to internationalize an application with ResourceBundles (.properties files). I don't know this application very well yet, neither Struts. There is a general myResources.properties file It is configured in struts-config:
myResources properties file contains german language strings. It works fine with JSPs, using <bean:message>. Now I have created a Resource file for polish language and placed it in the same directory: myResources_pl.properties. Just in case I also created myResources_pl_PL.properties.
In my browser I have set polish locale and removed all others. In the HTTP header the browser sends:
Accept-Language: pl
Also as mentioned here:
http://struts.apache.org/1.x/apidocs/org/apache/struts/util/package-summary.html
I have added a locale init param to the web.xml:
And added a tag to the
JSP which I use for
testing:
Now,when building the application and running it, it still displays strings from myResources properties when using:
myResources_pl.properties is ignored unfortunately. Then I put this code inside a custom tag (extends TagSupport) and printed out the "key"
string which DOES display the string from the pl_PL file:
So, Struts does retrieve the polish locale from the request and it can select the localized Resource bundle.
Now, the problem remains that when printing something with <bean:message/> those strings still come from the myResource.properties.
As a last resort I thought about accessing the Action.LOCALE_KEY somehow and change it programatically, maybe by overriding the ActionServlet.init method. So I was asking for help with accessing session and request from this method although I can't believe that something like this really needs to be done.
Any ideas?