struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: i18n implementation
Date Sat, 07 Dec 2002 02:34:03 GMT

On Fri, 6 Dec 2002, Eric Tse wrote:

> Date: Fri, 6 Dec 2002 12:07:59 +0800
> From: Eric Tse <>
> Reply-To: Eric Tse <>
> To: Craig R. McClanahan <>
> Cc: Struts Users Mailing List <>
> Subject: Re: i18n implementation
> Hi Craig,
> Thanks for your email! I have just tried your latest nighty build and it is
> what I want to have!! Thanks a lot!!
> I have one more question. Where or which setting do <bean:message
> key="index.logon"/> in index.jsp detects it is in Japanese locale? I
> observed that the Locale is set to ja when I access index.jsp and
> corresponding is loaded. Since I need to
> make a language selection screen at index.jsp, does it mean i need to
> hardcode the English message instead of specifiying any <bean:message ..../>
> ?

Struts stores the user's selected Locale as a session attribute under the
key Action.LOCALE_KEY.  If there's no such attribute already, it chooses
based on the user's preferred language (which is sent in the
"Accept-Languages" HTTP header).

To create your own language chooser, simply set up a simple form with just
a select box listing the languages you support, and submit to an Action
that reads the specified selection, creates a corresponding Locale, and
stores it in the session attribute under the specified key.  This
selection will hold until the user changes it, or until the session
expires or is timed out.

> Thanks a lot.
> Regards,
> Eric


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message