cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Merico Raffaele <>
Subject AW: Setting the Locale during login
Date Tue, 07 Dec 2004 08:06:32 GMT
Hi Andrew

If you have your sitemap configured as follows:

--- sitemap snip ---
    <map:action logger="sitemap.action.locale" name="locale"

  <map:act type="locale">
    <map:match type="wildcard" pattern="....">
      <map:transform type="i18n">
        <map:parameter name="locale" value="{../locale}"/>
        <map:parameter name="untranslated-text" value="untranslated"/>
--- EOF sitemap snip ---

than for the determination of the current locale the following rules are
1) the request-parameter locale (ie locale=de_CH) is given and valid
2) the session-attribute locale is defined and valid
3) a cookie is found its parameter name is locale
4) the locale of the request-object is used (this corresponds usually to the
definition in the Web Browser)

When one rule is satisfied, the other one are ignored. Satisfied means: the
locale is defined and can be referenced with {../locale} in the sitemap).

So, using this approach a system can start working with the locale
definition in the web browser of the user. If the user wants to change the
locale he has to process a HTTP request (GET/POST) that contains also a
locale=%NEW_LOCALE% parameter. This value is than stored in its session. Any
further request will than be handled with this value stored in the session. 

Hope this helps ... Raffaele

Raffaele Merico
LESS Informatik AG
Böhnirainstrasse 14
CH-8800 Thalwil

> -----Urspr√ľngliche Nachricht-----
> Von: Andrew MacDonald []
> Gesendet: Montag, 6. Dezember 2004 18:10
> An:
> Betreff: Setting the Locale during login
> Hello,
> We're trying to internationalize our portal and are
> having difficulty with the locale.  Currently, when
> the user logs in to the portal, the locale is passed
> as a request parameter (tacked onto the login form
> action).  However, we'd like to replace the request
> parameter locale with the user's locale preference (if
> they have one) which is loaded into the authentication
> context during login.  Currently we're doing this
> replacement in flow after the login process, but would
> like to have it performed during login (in the
> sitemap).  Any ideas on how this could be
> accomplished?
> Thanks,
> Andrew MacDonald
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - Easier than ever with enhanced search. Learn more.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message