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

simon at wyona.com simon at wyona.com
Fri Mar 20 10:44:48 CET 2009


Author: simon
Date: 2009-03-20 10:44:47 +0100 (Fri, 20 Mar 2009)
New Revision: 42069

Modified:
   public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml
Log:
documentation improved.

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	2009-03-20 09:38:11 UTC (rev 42068)
+++ public/yanel/trunk/src/realms/yanel-website/content/documentation/i18n/en.xhtml	2009-03-20 09:44:47 UTC (rev 42069)
@@ -1,20 +1,36 @@
-<?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">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
 <head>
-  <title>Internationalization in YANEL</title>
+<title>Untitled document</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;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>
+<p>This example assumes that you are using the XMLResource (or any other subclass of BasicXMLResource).</p>
+<p>Example message catalogue (let's say it's stored in the default repository of your realm, with the path /i18n/foo.xml):</p>
+<pre>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;<br />&lt;messages&gt;<br />  &lt;message key="foo.user"&gt;<br />    &lt;text language="de"&gt;Benutzer&lt;/text&gt;<br />    &lt;text language="en"&gt;User&lt;/text&gt;<br />  &lt;/message&gt;<br />  &lt;message key="foo.logout"&gt;<br />    &lt;text language="de"&gt;Abmelden&lt;/text&gt;<br />    &lt;text language="en"&gt;Log out&lt;/text&gt;<br />  &lt;/message&gt;<br />  &lt;message key="foo.registeredUsers"&gt;<br />    &lt;text language="de"&gt;Es sind {0} Benutzer registriert.&lt;/text&gt;<br />    &lt;text language="en"&gt;{0} users are registered.&lt;/text&gt;<br />  &lt;/message&gt;<br />&lt;/messages&gt;<br /></pre>
+<p>To translate text using this catalogue, use the following code in your xslt:<br /><tt><br />&lt;i18n:text xmlns:i18n="http://www.wyona.org/yanel/i18n/1.0" key="foo.user"/&gt;</tt><br /><br />To translate an attribute:<tt><br /><br />&lt;input type="submit" value="foo.logout" i18n:attr="value"/&gt;</tt></p>
+<p>Respectivle for multiple attribute translation:</p>
+<p>&lt;input type="button" name="Name" value="foo.button.value" title="foo.button.tooltip" i18n:attr="value title"/&gt;</p>
+<p>&#160;</p>
+<p>To translate a text with parameters:</p>
+<p><tt>&lt;i18n:translate&gt;<br />&#160; &lt;i18n:text key="foo.registeredUsers"/&gt;<br />&#160; &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:</p>
 <ol>
-<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>
+<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>:</p>
+<p><tt>&lt;i18n-catalogue&gt;yanelrepo:/i18n/foo.xml&lt;/i18n-catalogue&gt;</tt></p>
+</li>
+</ol>
+<h3>How it works</h3>
+<p>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.</p>
+<h3>Multiple Catalogues</h3>
+<p>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 look 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 /></p>
+</body>
 </html>
\ No newline at end of file



More information about the Yanel-commits mailing list