Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: Tiles and Struts not using same local initially

Antonio Petrelli

2006-12-13

Replies:

Matthias Stoll ha scritto:
> Hi there.
>
> I have a Tiles / Struts application. When using i18n in Struts (property
> files) everything works fine, even if the user has selected a language in
> his browser (e.g. en as preferred language, struts loads the property_en
> file). Tiles is not doing so. It loads the default definition file
> (without _en or _de) at initialization. Struts controller Locale is set to
> true. Tiles only changes locale when manually setting
> request.getSession().setAttribute (Globals.LOCALE_KEY, Locale.ENGLISH).
> Does anyone have an idea, what the problem is?
>  

Uh you're right! I18NFactorySet takes the locale only from the session!
Anyway you can:
* use Tiles 2 (that is currently in the sandbox
http://struts.apache.org/struts-sandbox/tiles/index.html ) that does not
suffer from this problem
* or create your own FactorySet, extending I18NFactorySet and overriding
the getDefinitionsFactoryKey, taking the locale from the request.
Obviously you have to register it in the Tiles plugin configuration.

HTH
Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.