cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Enrico Ballarin Dolfin" <enri...@swissonline.ch>
Subject i18n problem setting the locale
Date Wed, 27 Aug 2003 14:55:04 GMT
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message