Yes, what I have works fine. Because it is cookie-based, it also persists to
subsequent sessions.

FYI, that app is running on T4.0.2

I actually do it from within a component:

        /**
         * listener to change language / locale
         */
        public void onSetLocale(IRequestCycle cycle) {
                getPage().getEngine().setLocale(getSelectedLocale());
                cycle.cleanup();
                throw new PageRedirectException(getPage().getPageName());
        }

The getSelectedLocale() is for a parameter passed from the page.  The only
other difference I see is that I used Locale.ENGLISH and Locale.FRENCH
rather than using new with the "language" string.  I don't know why that
would be an issue.


> -----Original Message-----
> From: dpark [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 07, 2008 10:28 AM
> To: users@tapestry.apache.org
> Subject: RE: Localization
> 
> 
> Thanks for the help but unfortunately that doesn't seem to work.  Here's
> what
> I do:
> 
>   public void setLanguage( String language )
>   {
>     getEngine().setLocale( new Locale( language ) );
>     getRequestCycle().cleanup();
>     throw new PageRedirectException( "Login" );
>   }
> 
> Are you telling me that for your application, every subsequent page (not
> just the one immediately after), after setting the locale, renders in the
> appropriate Locale?
> 
> Must be something with my pool....(i haven't done any customizations
> around
> that...)
> 
> I'll keep poking around
> 
> DP
> 
> 
> 
> 
> Jonathan Barker wrote:
> >
> > Try executing cycle.cleanup() after you set the Locale.
> >
> >
> >> -----Original Message-----
> >> From: dpark [mailto:[EMAIL PROTECTED]
> >> Sent: Wednesday, May 07, 2008 10:14 AM
> >> To: users@tapestry.apache.org
> >> Subject: Localization
> >>
> >>
> >> I understand the following:
> >> * in order to set the locale programmatically, you call the following:
> >> getEngine().setLocale( new Locale( language ) );
> >> * then I call getRequestCycle().activate( "SOME_PAGE" );
> >> * Voila, I see the SOME_PAGE loaded with the locale specific properties
> >> and
> >> assets.
> >>
> >> HOWEVER, when I then navigate to another page, I suddenly lose the
> locale
> >> i
> >> just set.
> >>
> >> Upon further investigation I see that the RequestLocaleManagerImpl is
> >> working correctly by reading the cookie and setting the ThreadLocale
> >> appropriately.
> >>
> >> I'm guessing there's something about the pool of pages that need to be
> >> reset
> >> to the appropriate locale.
> >>
> >> Can anyone shed some light on how (if at all) there's a way to do this?
> >>
> >> Thanks!
> >>
> >> DP
> >> --
> >> View this message in context: http://www.nabble.com/Localization-
> >> tp17106010p17106010.html
> >> Sent from the Tapestry - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/Localization-
> tp17106010p17106173.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to