You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Gamble, Wesley (WG10)" <WG...@tmw.com> on 2008/06/09 22:44:25 UTC

How to force a default locale in Struts2?

All,

 

Tomcat 6.0

Struts 2.0.11.1

Tiles 2.0.6

 

I've successfully implemented locale specific properties in one of my
JSPs, and I can successfully get the alternate locale by passing
"request_locale="fr" in my request like so:

 

http://localhost:8080/ApplicantTracking/applicationStart.action?request_
locale=fr

 

So I know that I can switch back to English by doing:

 

http://localhost:8080/ApplicantTracking/applicationStart.action?request_
locale=en

 

What confuses me, however, is if I restart Tomcat and ask for the URL
(notice no request_locale parameter):

 

http://localhost:8080/ApplicantTracking/applicationStart.action

 

and the last time I looked at this page it was in French, I will get the
French version even though I haven't provided a request_locale
parameter.

 

I would think that I would get the English version, since the "regular"
properties file (ApplicationStartAction.properties) is in English.

 

My English properties file is ApplicationStartAction.properties

My French properties file is ApplicationStartAction_fr.properties

 

Is the request_locale stored in a cookie or something?  Why does the
choice of French locale appear to persist across reboots of Tomcat even
though I ask for the page without locale specificity?

 

Thanks,

Wes

 


RE: How to force a default locale in Struts2?

Posted by "Gamble, Wesley (WG10)" <WG...@tmw.com>.
I read further in the _Struts 2 in Action_ book and it indicates that
there is a session parameter that is set with the current locale.

So it appears that the request_locale parameter must be set specifically
to switch between locales.

Wes

-----Original Message-----
From: Lukasz Lenart [mailto:lukasz.lenart@googlemail.com] 
Sent: Monday, June 09, 2008 4:02 PM
To: Struts Users Mailing List
Subject: Re: How to force a default locale in Struts2?

Hi

You can set constant
struts.locale=en_US

in struts.properties or struts.xml or web.xml

http://struts.apache.org/2.x/docs/strutsproperties.html


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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


Re: How to force a default locale in Struts2?

Posted by Lukasz Lenart <lu...@googlemail.com>.
Hi

You can set constant
struts.locale=en_US

in struts.properties or struts.xml or web.xml

http://struts.apache.org/2.x/docs/strutsproperties.html


Regards
-- 
Lukasz
http://www.lenart.org.pl/