cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <giac...@apache.org>
Subject Re: LangSelect, bug ?
Date Mon, 28 May 2001 08:06:15 GMT
Quoting "Piroumian, Konstantin" <KPiroumian@flagship.ru>:

> > >
> > > That is the one of the features that have to be implemented.
> > > I am thinking of such sequence of language selection:
> > >
> > > 1. Check request for a param with a name 'lang' (if the user
> > > choosed another
> > > language manually).
> > > 2. Lookup for a 'lang' cookie.
> > > 3. Lookup for a session attribute 'lang'.
> > > if none of this is succesful, then:
> > > 4. Check the accept-languages header and select the first (supported
> by
> > > application) language.
> > > if no supported langs or no information in the header:
> > > 5. Set the default language for the site (configured in the
> sitemap).
> > > 6. or set English as the current language.
> >
> > I think the session should go before the cookie, so you can log in to
> a
> site
> > with a different languaje only for that session, without changing the
> > default languaje for your future visits there.
> 
> Ok, agree.
> 
> So, are there any suggestions how that behavior can be controlled?
> Is it a LangSelect's task to store the language in the session or in a
> cookie?
> I've implemented some configuration possibilities for the LangSelect,
> but
> I'm not sure that they can be very useful in the case, when lang for the
> session differs from the lang in a cookie. Now the action can be used as
> this:
> 
>     <map:action name="lang-select"
> src="org.apache.cocoon.acting.LangSelect">
>         <!-- Should the action create a session to store the language
> code. -->
>         <create-session>true</create-session>
>         <!-- Should the action store the lang code in the session -->
>         <store-in-session>true</store-in-session>
>         <!-- Should the action store the lang code in a cookie -->
>         <store-in-cookie>true</store-in-cookie>

I can see the need for a <store-in-request> as an request attribuite as well 
(for those not using sessions nor cookies at all).

>         <!--
>             I am going to add other configuration params:
>             cookie-age - the cookieAge attribute of the cookie with the
> lang
> code
>             param-name - the name of the request param, the session
> attribute and the name of the cookie.
>             Now it's hard coded and equals to 'lang'.
>         -->
>     </map:action>
> 
> Maybe it's better to make these settings params, so for some pipelines
> thay
> can be defined dynamicaly from the sitemap?

I think it's better to have config and parameters as well. Former is meant as 
default behaviour later as runtime overriding value. I've made that for the 
TraxTransformer as well. This eliminate the need to define differently 
configured components of the same implementation where you have default for the 
usual case and are able to change them in the pipeline for special use.

> Btw, why the syntax for configuration and sitemap params are different?
> Why
> not to use:
>   <parameter name="create-session" value="true" />?

The configuration is a hierarchical structure (XML fragment) where as the 
Parameters are name/value pairs. 

Giacomo

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message