cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piroumian, Konstantin" <>
Subject Re: Help with i18n
Date Fri, 01 Feb 2002 09:33:21 GMT

For locale selection use LocaleAction like this:
<map:action name="locale"

<!-- Btw, does this matcher work for you? You are matching exactly the
'file' and won't have {1} parameter -->
<map:match pattern="file">

    <!-- This action will set users locale -->
    <map:act type="select-locale" />
  <map:generate src="{1}"/>
  <map:transform type="i18n">
        <!-- Available langs are not supported anymore - just add
dictionaries for a new locale, otherwise the default one will be used -->
        <parameter name="src" value="translations/dictionary.xml"/>
  <map:transform src="stylesheet.xsl"/>
  <map:serialize />

You can use this action at the top level to allow locale selection for all
requests. See:

Currently, the locale for the translation is selected internaly, using the
same LocaleAction.getLocaleAttribute() method. There were a little
discussion on this subject, so maybe something will be changed. I've
proposed to specify the locale for the i18n transformer externally as a
parameter. In this case you use matchers like this:

<!-- This will match 'en/page.xml' or 'en_US/page.xml' etc. -->
<map:match pattern="*/*.xml">
    <map:act type="select-locale" />
    <map:generate src="{2}.xsp"/>
    <map:transform type="i18n">
        <parameter name="locale" value="{1}"/>
        <parameter name="src" value="translations/dictionary.xml"/>
  <map:transform src="stylesheet.xsl"/>
  <map:serialize />

This is not yet supported, but you are free to implement it yourself - it's
Open Source.


----- Original Message -----
From: Chitharanjan Das
To: ;
Sent: Friday, February 01, 2002 1:10 AM
Subject: Help with i18n

Hello Konstantin,

The following is the match description in site-map..

<map:match pattern="file">
  <map:generate src="{1}"/>
  <map:transform type="i18n">
    <parameter name="available_lang_1" value="en"/>
    <parameter name="available_lang_2" value="ru"/>
    <parameter name="src" value="translations/dictionary.xml"/>
  <map:transform src="stylesheet.xsl"/>
  <map:serialize />

The XML to be translated is
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:i18n="">
  <elem title="main_title" i18n:attr="title">
    <i18n:text>Text to be translated</i18n:text>

Where and how do I specify the locale for the translation?


accordia, inc
34347 Maybird Circle
Fremont, CA 94555
650 279 1137

The information contained in this communication is intended solely for the
use of the individual or entity to whom it is addressed and others
authorized to receive it. It may contain confidential or legally privileged
information. If you are not the intended recipient you are hereby notified
that any disclosure, copying, distribution or taking any action in reliance
on the contents of this information is strictly prohibited and may be
unlawful. If you have received this communication in error, please notify us
immediately by responding to this email and then delete it from your system.
Accordia Inc. is neither liable for the proper and incomplete transmission
of the information contained in this communication nor for any delay in its

Please check that your question has not already been answered in the
FAQ before posting. <>

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

View raw message