[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><?xml version="1.0" encoding="UTF-8" ?><br/><messages><br/> <message key="foo.user"><br/> <text language="de">Benutzer</text><br/> <text language="en">User</text><br/> </message><br/> <message key="foo.logout"><br/> <text language="de">Abmelden</text><br/> <text language="en">Log out</text><br/> </message><br/> <message key="foo.registeredUsers"><br/> <text language="de">Es sind {0} Benutzer registriert.</text><br/> <text language="en">{0} users are registered.</text><br/> </message&g!
t;<br/></messages><br/></pre>To translate text using this catalogue, use the following code in your xslt:<br/><tt><br/><i18n:text xmlns:i18n="http://www.wyona.org/yanel/i18n/1.0" key="foo.user"/></tt><br/><br/>To translate an attribute:<tt><br/><br/><input type="submit" value="foo.logout" i18n:attr="value"/></tt>
<p>To translate a text with parameters:</p><p><tt><i18n:translate><br/> <i18n:text key="foo.registeredUsers"/><br/> <i18n:param>7</i18n:param><br/></i18n:translate></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><i18n-catalogue>yanelrepo:/i18n/foo.xml</i18n-catalogue></tt>
-</p></li><li><p>Realm specific messages<br/>Add the following element to your realm.xml:<br/></p><p><tt><i18n-catalogue>yanelrepo:/i18n/foo.xml</i18n-catalogue></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><i18n-catalogue>yanelrepo:/i18n/foo.xml</i18n-catalogue></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><i18n-catalogue>yanelrepo:/i18n/foo.xml</i18n-catalogue></tt>
</p></li></ol><h3>How it works</h3>There is a transformer (I18nTransformer) which transforms the <i18n:text> 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