struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
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 <erictks@netvigator.com>
> Reply-To: Eric Tse <eric-ks.tse@hp.com>
> To: Craig R. McClanahan <craigmcc@apache.org>
> Cc: Struts Users Mailing List <struts-user@jakarta.apache.org>
> 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 ApplicationResources_ja.properties 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

Craig



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message