I see two ways of preserving the selected locale (if you don't want to use sessions):
1. Add 'locale' attribute with the selected language to each link on the page. You can pass this paramter to a transformer that will do the job. 2. Use cookies on the client side to store the locale. This can be turned on by using LocaleAction and adding <store-in-cookie>true</store-in-cookie> parameter. You can see an example of how to use LocaleAction in i18n samples. -- Konstantin From: "Enrico Ballarin Dolfin" <[EMAIL PROTECTED]> > Hi > > we would like to internationalize our site and to do this we are > experimenting on a small prototype. > > We have a startpage where we can select other laguages and a picture with a > link to a second page. > > Basically we would like to select the wished language or accept the default > language on the startpage and then continue to the second page using the > same language. The language selection will be done only on the startpage. > To achive this behaviour we are appending to the existing links a parameter > e.g. "http://localhost:8080/startpage?locale=fr" for the french language, if > we have selected it on the startpage. > > The first time that you arrive to the startpage there is no such parameter: > "http://localhost:8080/startpage" so that cocoon displays the startpage in > the computer default language e.g. "de" if a translation dictionary for it > exists, otherwise in english. > > If we change language on the startpage we get the same startpage written in > this language with a link like "http://localhost:8080/startpage?locale=fr" > and this will be processed from the same resource in the sitemap: > > <map:match pattern="startpage"> > <map:generate src="test/resources/start.xml"/> > <map:transform type="i18n"/> > <map:transform src="test/styles/start.xsl"> > <map:parameter name="use-request-parameter" value="true"/> > </map:transform> > <map:serialize/> > </map:match> > > Later we can also go to the second page keeping the selected language. > > The problem is that if we accept in the startpage the default language, we > have a link to the second page without the locale parameter set e.g. > "http://localhost:8080/startpage?locale=" . > > If we define in the start.xsl this parameter with default value english, > like this > > <xsl:param name="locale">en</xsl:param> > > we continue to the second page in english independently of which was the > default language of the startpage. > > What we need is to display the startpage in the default language, optionally > change the language redisplaying the start page in this language, and > continue to the second page keeping the same language. > > I think we need to get the system default language and set the "locale" > variable to it as default, except if we call explicitly the page with the > "locale" parameter set to a specific language e.g. > "http://localhost:8080/startpage?locale=fr" . > > In our site we are using cocoon 2.0.4 and we not using sessions. > > Is there any way to achive this behaviour? > > Thanks a lot in advance > Enrico > > > > --------------------------------------------------------------------- > 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]