You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kurosaka, Teruhiko" <Te...@iona.com> on 2002/07/16 03:33:53 UTC

What does locale="true" really do?

Hello,
Various documents suggest that we are supposed to say:
<html:html locale="true">
in Struts-based JSP files.  This directive somehow sets
the locale automatically, as I understand it.
But I am wondering exactly how Struts sets a locale.
Does anyone know?

I am hoping that Struts won't just blindly pick up the
language of the heaviest weight in the request's
Accept-Language header, because that is simply
wrong.  When there is no German version of a .jsp
file, "accept-language: de" should not be honored,
for example.  I am hoping that somehow Struts knows
the list of available languages for a page, but I cannot
seem to locate that description.  Does anyone know
anything about it?

----
T. "Kuro" Kurosaka, Internationalization Architect
IONA Technologies, Santa Clara, CA USA

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: What does locale="true" really do?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 15 Jul 2002, Kurosaka, Teruhiko wrote:

> Date: Mon, 15 Jul 2002 18:33:53 -0700
> From: "Kurosaka, Teruhiko" <Te...@iona.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Cc: "Kurosaka, Teruhiko" <te...@iona.com>
> Subject: What does locale="true" really do?
>
> Hello,
> Various documents suggest that we are supposed to say:
> <html:html locale="true">
> in Struts-based JSP files.  This directive somehow sets
> the locale automatically, as I understand it.
> But I am wondering exactly how Struts sets a locale.
> Does anyone know?
>

The implementation of this tag grabs the current locale from the session
(set from either a call to request.getLocale() or later updated by the
application) and uses that to set the "lang" attribute on the <html> tag.

> I am hoping that Struts won't just blindly pick up the
> language of the heaviest weight in the request's
> Accept-Language header, because that is simply
> wrong.  When there is no German version of a .jsp
> file, "accept-language: de" should not be honored,
> for example.  I am hoping that somehow Struts knows
> the list of available languages for a page, but I cannot
> seem to locate that description.  Does anyone know
> anything about it?
>

Struts doesn't know anything about this, because "languages available" is
an application specific concept.  However, your application is
free to set the Locale (in the session, under key Action.LOCALE_KEY) to
whatever you think is correct.

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>