[Yanel-commits] rev 32624 - in public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n: . en.xhtml.yarep en.xhtml.yarep/revisions en.xhtml.yarep/revisions/1204195101158

josias at wyona.com josias at wyona.com
Thu Feb 28 11:26:23 CET 2008


Author: josias
Date: 2008-02-28 11:26:23 +0100 (Thu, 28 Feb 2008)
New Revision: 32624

Added:
   public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/revisions/
   public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/revisions/1204195101158/
   public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/revisions/1204195101158/content
   public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/revisions/1204195101158/meta
Modified:
   public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml
   public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/meta
Log:
updated documentation about i18n

Modified: public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml
===================================================================
--- public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml	2008-02-28 09:51:37 UTC (rev 32623)
+++ public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml	2008-02-28 10:26:23 UTC (rev 32624)
@@ -7,38 +7,14 @@
   <title>Internationalization in YANEL</title>
 </head>
 <body>
-<h2>How i18n works within YANEL</h2>
-
-<p>
-Currently, <tt><b>i18n</b></tt> only works for the <tt><b>NutchResource</b></tt>.<br/>
-Like in <a href="http://cocoon.apache.org/"><tt>Cocoon</tt></a> keys for each message have to be defined.<br/>
-But unlike in <tt>Cocoon</tt> the key value pairs are not stored in a XML file, but in properties.<br/>
-</p>
-<p>
-These properties are stored in the <tt><b>conf</b></tt> directory of the resource, <tt>[src/contributions/resources/nutch/conf/&lt;FAMILY&gt;_&lt;LOCALE&gt;.properties]</tt>.<br/>
-Resource bundles belong to families whose members share a common base name, but whose names also have additional components that identify their locales. 
-For example, the base name of a family of resource bundles might be <tt><b>messages</b></tt>. The family should have a default resource bundle which simply has the same name as its family - <tt><b>messages</b></tt> - 
-and will be used as the bundle of last resort if a specific locale is not supported. The family can then provide as many locale-specific members as needed, for example a German one named <tt><b>messages_de</b></tt>.
-</p>
-<p>
-Each resource bundle in a family contains the same items, but the items have been translated for the locale represented by that resource bundle. For example, both <tt><b>messages</b></tt> and <tt><b>messages_de</b></tt> may have a 
-String that's used on a button for canceling operations. In <tt><b>messages</b></tt> the String may contain <tt><b>Cancel</b></tt> and in <tt><b>messages_de</b></tt> it may contain <tt><b>Abbrechen</b></tt>.
-</p>
-<p>
-After having replaced all Messages with a <br/><tt><b>&lt;i18n:message key="KEY_TO_BE_TRANSLATED"/&gt;</b></tt> a Transformer will parse the XML file look for these tags and replace the value of the key with the key from the properties file.<br/>Here's an example:
-</p>
-<p>
-Assuming you want the following text internationalized:<br/> <tt><b>"Hello World"</b></tt> you would have to replace the Hallo World with a tag <tt><b>&lt;i18n:message key="HelloWorld"&gt;</b></tt> where the key has to be unique within a bundle named messages.<br/>
-</p>
-<p>
-The transformer finds this tag looks in his properties for the selected locale, which is here by default (<b>en</b>)glish if no <tt>request.parameter</tt> name <tt>yanel.meta.language</tt> is given, and replaces the 
-<tt><b>&lt;i18n:message key="HelloWorld"&gt;</b></tt> with the value from <tt>messages_en.properties</tt>. So that the result would be <tt><b>"Hello World"</b></tt>.<br/>
-</p>
-<p>
-Attributes are handled a bit different. For attributes e.g. within a form imagine the submit button. You would have to have e.g. <tt>&lt;input type="submit" value="<b>i18n:attr key=cancel</b>"&gt;</tt>
-here the transformer will look for a key cancel within the properties and replace it with the selected language. 
-</p>
-
-
-</body>
-</html>
\ No newline at end of file
+<h2>How i18n works in Yanel</h2>
+<h3>Overview</h3>
+<p>I18n serves for translating parts of your application to different languages. It uses a message catalogue to look up a message in a given language which is identified by a unique key.</p>
+<h3>Example</h3>
+<p>This example assumes that you are using the XMLResource (or any other subclass of BasicXMLResource).<br/></p><p>Example message catalogue (let's say it's stored in the default repository of your realm, with the path /i18n/foo.xml):<br/></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;<br/>&lt;messages&gt;<br/>  &lt;message key=&quot;foo.user&quot;&gt;<br/>    &lt;text language=&quot;de&quot;&gt;Benutzer&lt;/text&gt;<br/>    &lt;text language=&quot;en&quot;&gt;User&lt;/text&gt;<br/>  &lt;/message&gt;<br/>  &lt;message key=&quot;foo.logout&quot;&gt;<br/>    &lt;text language=&quot;de&quot;&gt;Abmelden&lt;/text&gt;<br/>    &lt;text language=&quot;en&quot;&gt;Log out&lt;/text&gt;<br/>  &lt;/message&gt;<br/>&lt;/messages&gt;<br/></pre>To translate text using this catalogue, use the following code in your xslt:<br/><tt><br/>&lt;i18n:text xmlns:i18n=&quot;http://www.wyona.org/yanel/i18n/1.0&quot; key=&quot;foo.user&quot;/&gt;</tt><br/><br/>Or to transla!
 te an attribute:<tt><br/><br/>&lt;input type=&quot;submit&quot; value=&quot;foo.logout&quot; i18n:attr=&quot;value&quot;/&gt;</tt>
+<p>The catalogue has to be associated with the content. There are two ways to do so: <br/></p>
+<ol>
+<li><p>Resource-specific messages<br/>Add a property to the resource configuration file (.rc):</p><p><tt>&lt;i18n-catalogue&gt;yanelrepo:/i18n/foo.xml&lt;/i18n-catalogue&gt;</tt>
+</p></li><li><p>Realm specific messages<br/>Add the following element to your realm.xml:<br/></p><p><tt>&lt;i18n-catalogue&gt;yanelrepo:/i18n/foo.xml&lt;/i18n-catalogue&gt;</tt>
+</p></li></ol><h3>How it works</h3>There is a transformer (I18nTransformer) which transforms the &lt;i18n:text&gt; elements  into the text messages from the catalogue. If no message is found for a given key and a given language, fallback to the default language is applied. If still no message is found, the transformer inserts the message key.<br/><br/>As of today there are three different versions of this transformer in yanel: I18nTransformer, I18nTransformer2, and I18nTransformer3. The first two versions are deprecated. They use a different syntax and they support only plain-text property files as catalogues (ResourceBundles).<br/>I18nTransformer3 still supports the old syntax and also allows to use ResourceBundle catalogues, so it's the recommended choice.<br/><h3>Multiple Catalogues</h3>It is possible to have more than one catalogue. <br/>A resource configuration can have several catalogues, the realm can have one, and Yanel has a global message catalogue. Yanel will loo!
 k for a message with a given key first in the resource catalogues, then in the realm catalogue, and eventually in the global catalogue.<br/><br/><br/></body>
+</html>

Modified: public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/meta
===================================================================
--- public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/meta	2008-02-28 09:51:37 UTC (rev 32623)
+++ public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/meta	2008-02-28 10:26:23 UTC (rev 32624)
@@ -1 +1,7 @@
 yarep_type<string>:resource
+yarep_isCheckedOut<boolean>:false
+yarep_checkoutDate<date>:2008-02-28T11:37:22+0100
+yarep_size<long>:3236
+yarep_checkoutUserID<string>:lenya
+yarep_lastModifed<long>:1204195101000
+yarep_checkinDate<date>:2008-02-28T11:38:21+0100

Added: public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/revisions/1204195101158/content
===================================================================
--- public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/revisions/1204195101158/content	                        (rev 0)
+++ public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/revisions/1204195101158/content	2008-02-28 10:26:23 UTC (rev 32624)
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <title>Internationalization in YANEL</title>
+</head>
+<body>
+<h2>How i18n works in Yanel</h2>
+<h3>Overview</h3>
+<p>I18n serves for translating parts of your application to different languages. It uses a message catalogue to look up a message in a given language which is identified by a unique key.</p>
+<h3>Example</h3>
+<p>This example assumes that you are using the XMLResource (or any other subclass of BasicXMLResource).<br/></p><p>Example message catalogue (let's say it's stored in the default repository of your realm, with the path /i18n/foo.xml):<br/></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;<br/>&lt;messages&gt;<br/>  &lt;message key=&quot;foo.user&quot;&gt;<br/>    &lt;text language=&quot;de&quot;&gt;Benutzer&lt;/text&gt;<br/>    &lt;text language=&quot;en&quot;&gt;User&lt;/text&gt;<br/>  &lt;/message&gt;<br/>  &lt;message key=&quot;foo.logout&quot;&gt;<br/>    &lt;text language=&quot;de&quot;&gt;Abmelden&lt;/text&gt;<br/>    &lt;text language=&quot;en&quot;&gt;Log out&lt;/text&gt;<br/>  &lt;/message&gt;<br/>&lt;/messages&gt;<br/></pre>To translate text using this catalogue, use the following code in your xslt:<br/><tt><br/>&lt;i18n:text xmlns:i18n=&quot;http://www.wyona.org/yanel/i18n/1.0&quot; key=&quot;foo.user&quot;/&gt;</tt><br/><br/>Or to transla!
 te an attribute:<tt><br/><br/>&lt;input type=&quot;submit&quot; value=&quot;foo.logout&quot; i18n:attr=&quot;value&quot;/&gt;</tt>
+<p>The catalogue has to be associated with the content. There are two ways to do so: <br/></p>
+<ol>
+<li><p>Resource-specific messages<br/>Add a property to the resource configuration file (.rc):</p><p><tt>&lt;i18n-catalogue&gt;yanelrepo:/i18n/foo.xml&lt;/i18n-catalogue&gt;</tt>
+</p></li><li><p>Realm specific messages<br/>Add the following element to your realm.xml:<br/></p><p><tt>&lt;i18n-catalogue&gt;yanelrepo:/i18n/foo.xml&lt;/i18n-catalogue&gt;</tt>
+</p></li></ol><h3>How it works</h3>There is a transformer (I18nTransformer) which transforms the &lt;i18n:text&gt; elements  into the text messages from the catalogue. If no message is found for a given key and a given language, fallback to the default language is applied. If still no message is found, the transformer inserts the message key.<br/><br/>As of today there are three different versions of this transformer in yanel: I18nTransformer, I18nTransformer2, and I18nTransformer3. The first two versions are deprecated. They use a different syntax and they support only plain-text property files as catalogues (ResourceBundles).<br/>I18nTransformer3 still supports the old syntax and also allows to use ResourceBundle catalogues, so it's the recommended choice.<br/><h3>Multiple Catalogues</h3>It is possible to have more than one catalogue. <br/>A resource configuration can have several catalogues, the realm can have one, and Yanel has a global message catalogue. Yanel will loo!
 k for a message with a given key first in the resource catalogues, then in the realm catalogue, and eventually in the global catalogue.<br/><br/><br/></body>
+</html>

Added: public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/revisions/1204195101158/meta
===================================================================
--- public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/revisions/1204195101158/meta	                        (rev 0)
+++ public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml.yarep/revisions/1204195101158/meta	2008-02-28 10:26:23 UTC (rev 32624)
@@ -0,0 +1,11 @@
+yarep_revisionComment<string>:updated
+yarep_type<string>:resource
+yarep_isCheckedOut<boolean>:false
+yarep_revisionCreator<string>:lenya
+workflow-date<date>:2008-02-28T11:38:21+0100
+yarep_size<long>:3236
+yarep_checkoutDate<date>:2008-02-28T11:37:22+0100
+yarep_checkoutUserID<string>:lenya
+yarep_lastModifed<long>:1204195101000
+workflow-state<string>:draft
+yarep_revisionCreationDate<date>:2008-02-28T11:38:21+0100



More information about the Yanel-commits mailing list