An upgrade to Tomcat 3.2.1 fixed the locale issue. Thanks.
Wayne
[EMAIL PROTECTED]
-----Original Message-----
From: Young, Wayne [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 12, 2001 3:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: wrong locale selected at runtime
I'm using Tomcat 3.1 in JBuilder 4. Maybe I need to upgrade?
I added the following to the top of one of my pages:
<%
java.util.Enumeration en = request.getHeaders("Accept-Language");
while (en.hasMoreElements())
System.out.println(en.nextElement());
%>
and received the following:
en-us,es-mx;q=0.5
But the page still displays in Spanish.
The order above matches the order in my IE preference. (en-us first
priority, es-mx second priority)
I've attached my JSP source. I am hitting an action first then forwarding to
this 'quicklinks.jsp' page.
Thanks.
Wayne
[EMAIL PROTECTED]
-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 12, 2001 2:26 PM
To: '[EMAIL PROTECTED]'
Subject: Re: wrong locale selected at runtime
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
> [EMAIL PROTECTED]
>
Craig McClanahan