Hi Firas,

Thank you for the 'getRequestCycle().cleanup();' line.

Daniel Trebbien.

On 7/24/06, Firas A. <[EMAIL PROTECTED]> wrote:
Hi Daniel,

You would probably need to use an DirectLink on your page template:
<a href="#" jwcid="@DirectLink" listener="listener:setNewLocale"
parameters="literal:de_DE">Click here for German</a>

In your page class:
public void setNewLocale(String localeString) {
        Locale newLocale = getLocale(localeString); // Must be defined
somewhere
        getEngine().setLocale(newLocale);
        /* Must call cleanup(), otherwise Tapestry will use the pooled page
           and your new locale won't be activated:
        */
        getRequestCycle().cleanup();
        // Display the page in a new locale
        throw new PageRedirectException(getPageName());
}

Hope this helps,

</Firas>

-----Original Message-----
From: Daniel Trebbien [ <mailto:[EMAIL PROTECTED]>
mailto:[EMAIL PROTECTED]
Sent: den 22 juli 2006 16:32
To: users@tapestry.apache.org
Subject: Explicitly setting the locale

Hello all,

I am developing a multilingual personal site for myself using Tapestry. I am
constantly setting my browser preferences to set the locale so that I can
view the page in each locale for testing.

This is somewhat time consuming. I would rather have links on the web page
that override the locale sent by the browser ('Click here for German',
'Click here for English').

Does anyone know how to do this?

Sincerely,
Daniel Trebbien.




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

Reply via email to