cocoon-users mailing list archives

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

For locale selection use LocaleAction like this:
<map:action name="locale"
        logger="sitemap.action.locale"
        src="org.apache.cocoon.acting.LocaleAction"
/>

...
<!-- 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>
  <map:transform src="stylesheet.xsl"/>
  <map:serialize />
</map:match>

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>
  <map:transform src="stylesheet.xsl"/>
  <map:serialize />
</map:match>

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

Regards,
    Konstantin

----- Original Message -----
From: Chitharanjan Das
To: kpiroumian@flagship.ru ; cocoon-users@xml.apache.org
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>
  <map:transform src="stylesheet.xsl"/>
  <map:serialize />
</map:match>


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

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

Regds,
Chiths


accordia, inc
34347 Maybird Circle
Fremont, CA 94555
650 279 1137
cdas@accordiasys.com

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
receipt


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message