1.1 --- a/docs/internationalisation.html Fri Mar 17 18:07:19 2006 +0000
1.2 +++ b/docs/internationalisation.html Fri Mar 17 18:27:03 2006 +0000
1.3 @@ -23,9 +23,12 @@
1.4 would resemble the following output document fragment:</p><pre><h1>Systemkonfigurasjon</h1></pre><p>Consequently,
1.5 a translation has been inserted in place of the original text. In
1.6 cases where no translation could be found, the original contents of the
1.7 -element would be preserved.</p><p>It is also possible to employ a
1.8 +element would be preserved.</p><h3>Named Translations</h3><p>It is also possible to employ a
1.9 specific translation as opposed to the text which just happen to reside
1.10 -inside an element; for example:</p><pre><h1 template:i18n="sysconfig">System Configurator</h1></pre><p>Here, instead of taking the exact text <code>System Configurator</code> as the "token" to be used to find a translation, we instead use the token with the name <code>sysconfig</code>. The effect, providing that the translation of <code>sysconfig</code> is <code>Systemkonfigurasjon</code>, would be the same as the result given above.</p><p>See the <a href="reference.html#i18n"><code>template:i18n</code></a> section of the <a href="reference.html">"Template Attribute Reference"</a> document for details of this annotation.</p><h2><a name="TranslatingAttributes"></a>Translating Attributes</h2><p>Consider the following document fragment:</p><pre><input type="submit" name="update" value="Update!"/></pre><p>In order to translate the label of this particular form control to another language, we must modify the <code>value</code> attribute as follows:</p><pre><input type="submit" name="update" value="{template:i18n('Update!')}"/></pre><p>Here,
1.11 +inside an element; for example:</p><pre><h1 template:i18n="sysconfig">System Configurator</h1></pre><p>Here, instead of taking the exact text <code>System Configurator</code> as the "token" to be used to find a translation, we instead use the token with the name <code>sysconfig</code>. The effect, providing that the translation of <code>sysconfig</code> is <code>Systemkonfigurasjon</code>, would be the same as the result given above.</p><h3>Value Translations</h3><p>In cases where the value being translated is not known before a document is to be displayed, one can either use the <code>template:i18n</code> extension function (as described below), special features of other annotations (such as <code>template:multiple-choice-value</code>), or expression-based translations, where an XPath expression is supplied within the annotation.</p><p>Here is an example for translating a multiple-choice field's values:</p><pre><select template:multiple-choice-field="-,type" name="..." value="..."><br /> <option template:multiple-choice-value="type-enum,type,selected,template:i18n(@type)" value="..."/><br /></select></pre><p>Note that this actually uses the <code>template:i18n</code> extension function in conjunction with the annotation's support for separate labels.</p><p>Here is how this might be done using an expression-based translation:</p><pre><select template:multiple-choice-field="-,type" name="..." value="..."><br /> <option template:i18n="{@type}" template:multiple-choice-value="type-enum,type,selected" value="..."/><br /></select></pre><p>In the above multiple-choice field definition, a range of values are presented that originates from <code>type</code> attributes on a number of <code>type-enum</code>
1.12 +elements. Instead of just presenting the raw values as the labels for
1.13 +the resulting pull-down menu, it is possible to override the
1.14 +underlying <code>template:value</code> mechanism and provide a translation instead.</p><p>See the <a href="reference.html#i18n"><code>template:i18n</code></a> section of the <a href="reference.html">"Template Attribute Reference"</a> document for details of this annotation.</p><h2><a name="TranslatingAttributes"></a>Translating Attributes</h2><p>Consider the following document fragment:</p><pre><input type="submit" name="update" value="Update!"/></pre><p>In order to translate the label of this particular form control to another language, we must modify the <code>value</code> attribute as follows:</p><pre><input type="submit" name="update" value="{template:i18n('Update!')}"/></pre><p>Here,
1.15 we insert an expression inside the attribute whose result will be
1.16 inserted in place of the expression. Note that for non-template
1.17 attributes, the expression must reside between <code>{</code> and <code>}</code> characters for the evaluation to take place. The anticipated result might resemble something like the following:</p><pre><input type="submit" name="update" value="Oppdatér"/></pre><p>Where