struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: wrong locale selected at runtime
Date Mon, 12 Mar 2001 20:25:38 GMT


On Mon, 12 Mar 2001, Young, Wayne wrote:

> 
> I have two languages in my IE 5.5 language preference with the following
> order of priority:
> English (United States) [en-us]
> Spanish (Mexico) [es-mx]
>

Struts 1.0b1 relies on the servlet container's implementation of
request.getLocale() to determine the default Locale.  What servlet
container and version are you running?  Would it be possible to write a
little debugging code and return the values that your application sees for
the "Accept-Language" header?  (There may be more than one, so you will
want to use request.getHeaderValue() instead of request.getHeader() for
this.)
 
> Note that [en-us] is listed first. But when I run my application, it shows
> me the Spanish resources. If I reverse the order, it shows me the English
> resources.
> 
> This worked correctly in struts 0.5, but with 1.0b1 it chooses the wrong
> locale. I have the locale init-param set in web.xml.
> <init-param>
>   <param-name>locale</param-name>
>   <param-value>true</param-value>
> </init-param>
>

This takes effect only on requests that go through the controller
servlet.  If the first request is to a JSP page (so that no Locale object
has been stored in the session yet), you will see the default language for
your server platform unless your JSP page includes:

	<html:html locale="true">
		...
	</html:html>

 
> Any suggestions? 
> 
> Thanks.
> 
> Wayne
> wyoung@metasolv.com
> 

Craig McClanahan



Mime
View raw message