Re: struts-menu & i18n - switching locale on user login

Danny Lee <[email protected]>
Newsgroups gmane.comp.java.struts-menu.user
Message-ID <[email protected]>
DE-EN, what? ;)

OK, look, you don't have to change the JSTL locale, if
you use struts. The only reason to do so, is a using two
different locale resources, which makes no sense. So
you better stick to struts locale and use the JSTL one
only for number formatting etc.

Now the second thingy, about the changing of locale. If the
menu titles are stored in the resources, and you know, that your 
resources are working fine, there's only one reason I can see
right now: you hold the MenuRepository in the session.

If it is so, you have to regenerate the repository and reload
it to the session every time the user switches the locale.

If you wan't to be really performance oriented you even better
put a HashMap of MenuRepositories combined with aviable locales into
the Application Scope ;)

Cheers,

Danny




Norbert Rieger wrote:
> Hi,
> I wan't to switch the "locale" based on user settings.
> I'm using struts and JSTL 1.2, switching locale works fine with:
> 
>         // change struts' locale
>         session.setAttribute(org.apache.struts.Globals.LOCALE_KEY,
> newLocale);
> 
>         // change JSTL's locale
>         Config.set(session, Config.FMT_LOCALE, newLocale) ;
> 
> But menu titles wan't switch, the appear always in the same language.
> 
> What do I have to set / change ?
> 
> I google I found a "solution", using MenuDisplayer's locale attribute, but I
> want work for me. Maybe am setting the attribute wrong.
> How do I have to set this attribute to read the JSTL/Struts locale ?
> 
> Thanxs a lot for your help.
> 
> Norbert
> 



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.