[Yanel-commits] rev 34626 - public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n

michi at wyona.com michi at wyona.com
Wed Apr 2 13:35:11 CEST 2008


Author: michi
Date: 2008-04-02 13:35:11 +0200 (Wed, 02 Apr 2008)
New Revision: 34626

Modified:
   public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml
Log:
links added to realm and resource docu

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-04-02 11:33:20 UTC (rev 34625)
+++ public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml	2008-04-02 11:35:11 UTC (rev 34626)
@@ -14,7 +14,7 @@
 <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;message key=&quot;foo.registeredUsers&quot;&gt;<br/>    &lt;text language=&quot;de&quot;&gt;Es sind {0} Benutzer registriert.&lt;/text&gt;<br/>    &lt;text language=&quot;en&quot;&gt;{0} users are registered.&lt;/text&gt;<br/>  &lt;/message&g!
 t;<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/>To translate an attribute:<tt><br/><br/>&lt;input type=&quot;submit&quot; value=&quot;foo.logout&quot; i18n:attr=&quot;value&quot;/&gt;</tt>
 <p>To translate a text with parameters:</p><p><tt>&lt;i18n:translate&gt;<br/>  &lt;i18n:text key=&quot;foo.registeredUsers&quot;/&gt;<br/>  &lt;i18n:param&gt;7&lt;/i18n:param&gt;<br/>&lt;/i18n:translate&gt;</tt></p><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>
+<li><p>Resource-specific messages<br/>Add a property to the resource configuration file (<a href="resources/what-is-a-resource-type.html">.yanel-rc</a>):</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 <a href="realm/realm-configuration.html">realm.xml</a>:<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>
\ No newline at end of file



More information about the Yanel-commits mailing list