2012/10/10 JOSE L MARTINEZ-AVIAL <[email protected]>:
> Hi all,
> I'm using Struts 2.2.3. I've setup a property "struts.locale" with value
> "es_ES", for Spanish. But my application is multilanguage, so I setup the
> locale in the request using an interceptor:
>
> public String intercept(ActionInvocation invocation) throws Exception {
> [...]
> <get locale for the user>
> [...]
> invocation.getInvocationContext().setLocale(userLocale);
> return invocation.invoke();
> }
>
>
> The action and the JSPs(I'm using Tiles),correctly use the locale I set(so
> the response has the body in the correct language), but the header
> content-language is returning always "es_ES", no matter the locale I put in
> the invocationcontext.
>
> Any ideas on how can I get the correct locale in the header? a Meta tag in
> the page is not an option, since I have the same problem even with
> JSONResults.
Try to set struts.locale to empty string
struts.locale=
or something that cannot be parsed as a Locale
struts.locale=es_es_es
then Dispatcher will use Locale from HttpServletRequest, but anyway
please report a bug, Dispatcher should base on LocaleProvider, right
now it looks like this:
Locale locale = null;
if (defaultLocale != null) { // <-- struts.locale
locale = LocalizedTextUtil.localeFromString(defaultLocale,
request.getLocale());
}
if (locale != null) {
response.setLocale(locale);
}
and the ActionContext is initialized as:
Locale locale;
if (defaultLocale != null) {
locale = LocalizedTextUtil.localeFromString(defaultLocale,
request.getLocale());
} else {
locale = request.getLocale();
}
anyway there is a mismatch :P
Thanks in advance
--
Ćukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]