I have a struts2 (2.1.6) based webapp which has two languages - english and norwegian. The default language for the app is norwegian - the application server (glassfish 2.1) is running under the english locale.
It didn't seem to matter what value I passed in to the request_locale parameter - I always got english.
There are two language files:
The struts constant struts.custom.i18n.resources was set to "global_messages" in struts.xml.
Googling suggested trying to set struts.locale=no in struts.xml - this may work for other versions - but did nothing under 2.1.6.
Passing in request_locale=no looked for a matching language file - and as it didn't find it - it tried to use the default language based on the locale of the app server
Up until now I was aware of two options
The solution was actually pretty simple.
Create a globalmessagesno.properties that is empty.
Then - when you set the requestlocale to no it matches the empty file. This then does not bother looking at the locale of the app server. However - there are no matching properties within the file - so it falls back using the standard filename based fallback to globalmessages.properties.
Exactly the result we want - the ability to switch to norwegian or english with only one copy of each. A bit of a hack but it works.
This is making it work by observation - my interpretation may be way off - however the result works for me.
If anyone knows a more correct solution (or description of the problem) feel free to add a comment - if there's a better way I want to be using it ;)