Konstantin While playing with the i18n transformations, I did write a french message file messages_fr.xml for the i18n samples. You will find a copy of the file herewith, as well as an updated version of the sample files simple.xml and simple.xsp. For these files, I added the items and links (lang_id6) for the new language:
<item> <link> <href>simple.xsp?locale=<i18n:text>lang_id6</i18n:text></href> <title> <i18n:text>language6</i18n:text> </title> </link> </item> I added the 2 following keys to message_fr.xml; but all the other message files need also the new keys for the new language, which I did not fix: <message key="lang_id6">fr</message> <message key="language6">Français</message> ... If Kurt also submits these files: feel free to choose the ones you prefer! By the way I noticed that when I was running simple.xml, the third article just showed: """ 3. Article: Troisièmement Hello """ This is the corresponding code fragment from simple.xml: <i18n:translate> <i18n:text>Hello</i18n:text> <i18n:param name="username"> <i18n:text>Kot</i18n:text> </i18n:param> </i18n:translate> I thought the second line should rather be: <i18n:text>Hello {0}</i18n:text> and fixed it in the attached files. On the same subject, I am not sure about the expected outcome of this fragment from simple.xsp: <i18n:translate> <i18n:text>Hello, {0}! Glad to see you!</i18n:text> <i18n:param name="username"> <xsp-request:get-parameter name="user" default="none" as="string"/> </i18n:param> </i18n:translate> It translates to: """ Salut none! Ravi de te voir! """ There is a key "none" in messages_XX.xml; from messages_fr.xml for instance: <message key="none">inconnu</message> I thought that the translation was not the expected outcome and did patch simple.xsp with the following code: <i18n:translate> <i18n:text>Hello, {0}! Glad to see you!</i18n:text> <i18n:param name="username"> <i18n:text><xsp-request:get-parameter name="user" default="none" as="string"/></i18n:text> </i18n:param> </i18n:translate> which not translates to: """ Salut inconnu! Ravi de te voir! """ I hope these nano-patches are somewhat useful... ;) Olivier Lange Le Petit Atelier de Génie logiciel Frêne 11, 1004 Lausanne, +41-21-6487665, [EMAIL PROTECTED]
<?xml version="1.0" encoding="UTF-8"?> <!-- CVS $Id: messages_de.xml,v 1.1 2002/01/03 12:31:42 giacomo Exp $ --> <!-- French message catalogue file for cocoon2 sample webapp --> <catalogue xml:lang="fr"> <message key="count_title">Cette page a été invoquée {0} fois. Dernière invocation: {1}.</message> <message key="a_key">Ceci est la valeur d'une clé.</message> <message key="lang_id1">en</message> <message key="lang_id2">ru</message> <message key="lang_id3">pl</message> <message key="lang_id4">es</message> <message key="lang_id5">hy</message> <message key="lang_id6">fr</message> <!-- [NEW] --> <message key="language">Allemand</message> <message key="language1">Anglais</message> <message key="language2">Russe</message> <message key="language3">Polonais</message> <message key="language4">Espagnol</message> <message key="language5">Arménien</message> <message key="language6">Français</message> <!-- [NEW] --> <message key="titletext">Bienvenue aux fonctions d'internationalisation!</message> <message key="doclink">Pour des informations détaillées, consulter la section i18n:</message> <message key="first">Premièrement</message> <message key="second">Deuxièmement</message> <message key="third">Troisièmement</message> <message key="forth">Quatrièmement</message> <message key="article">Article</message> <message key="article_text1">Ceci est un paragraphe auquel une transformation i18n a été appliquée.</message> <message key="article_text2">Ceci est autre un paragraphe auquel une transformation i18n a été appliquée et il s'en porte d'autant mieux!</message> <message key="copyright">Copyright © 2001 Konstantin Piroumian. Traduction française de Olivier Lange.</message> <message key="Hello, {0}! Glad to see you!">Salut {0}! Ravi de te rencontrer!</message> <message key="Kot">Chat</message> <message key="none">inconnu</message> <message key="one">un</message> <message key="two">deux</message> </catalogue>
<?xml version="1.0" encoding="UTF-8"?> <root xmlns:i18n="http://apache.org/cocoon/i18n/2.0"> <title> <i18n:text>titletext</i18n:text> </title> <sub-title> <i18n:date-time pattern="FULL"/> </sub-title> <annotation> <i18n:text>doclink</i18n:text> <link> <href>http://xml.apache.org/cocoon/userdocs/transformers/i18n-transformer.html</href> <title>Cocoon 2 Web Site</title> </link> </annotation> <menu> <item> <title><i18n:text>language</i18n:text></title> </item> <item> <link> <href>simple.xml?locale=<i18n:text>lang_id1</i18n:text></href> <title> <i18n:text>language1</i18n:text> </title> </link> </item> <item> <link> <href>simple.xml?locale=<i18n:text>lang_id2</i18n:text></href> <title> <i18n:text>language2</i18n:text> </title> </link> </item> <item> <link> <href>simple.xml?locale=<i18n:text>lang_id3</i18n:text></href> <title> <i18n:text>language3</i18n:text> </title> </link> </item> <item> <link> <href>simple.xml?locale=<i18n:text>lang_id4</i18n:text></href> <title> <i18n:text>language4</i18n:text> </title> </link> </item> <item> <link> <href>simple.xml?locale=<i18n:text>lang_id5</i18n:text></href> <title> <i18n:text>language5</i18n:text> </title> </link> </item> <!-- [NEW] --> <item> <link> <href>simple.xml?locale=<i18n:text>lang_id6</i18n:text></href> <title> <i18n:text>language6</i18n:text> </title> </link> </item> <!-- [/NEW] --> </menu> <menu> <item> <link> <href>simple.xml?locale=en_US</href> <title>English (US)</title> </link> </item> <item> <link> <href>simple.xml?locale=en_GB</href> <title>English (GB)</title> </link> </item> <item> <link> <href>simple.xml?locale=ru_RU</href> <title>Russian (Russia)</title> </link> </item> <item> <link> <href>simple.xml?locale=de_AT_EURO</href> <title>German (Austria, Euro)</title> </link> </item> </menu> <content> <para title="first" name="article" i18n:attr="title name"> <i18n:text i18n:key="a_key">article_text1</i18n:text> </para> <para title="second" name="article" i18n:attr="title name"> <i18n:text>article_text2</i18n:text> </para> <para title="third" name="article" i18n:attr="title name"> <i18n:translate> <!-- [PATCH] --> <!-- <i18n:text>Hello</i18n:text> --> <i18n:text>Hello {0}</i18n:text> <!-- [/PATCH] --> <i18n:param name="username"> <i18n:text>Kot</i18n:text> </i18n:param> </i18n:translate> </para> <para title="forth" name="article" i18n:attr="title name"> <i18n:translate> One = {0}, two = {1}, {2}! {3} This line is not translated {3} <i18n:param name="one"><i18n:text>one</i18n:text></i18n:param> <i18n:param name="two"><i18n:text>two</i18n:text></i18n:param> <i18n:param name="third">baby</i18n:param> <i18n:param name="forth"> ~ </i18n:param> </i18n:translate> </para> <para title="Number formatting (not translated)" name="article" i18n:attr="name"> <i18n:translate> Number : {0} | Currency: {1} | Percent: {2}, processed on: {3} <i18n:param type="number" src-locale="en" value="1703.74" /> <i18n:param type="number" sub-type="currency" src-locale="en">27.24</i18n:param> <i18n:param type="number" sub-type="percent" src-locale="en">1.2</i18n:param> <i18n:param type="date-time" pattern="MEDIUM"/> </i18n:translate> </para> </content> <bottom> <copyright> <i18n:text>copyright</i18n:text> </copyright> </bottom> </root>
simple.xml.diff
Description: Binary data
simple.xsp
Description: Binary data
simple.xsp.diff
Description: Binary data
--------------------------------------------------------------------- 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: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>