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
2.1 --- a/docs/reference.html Fri Mar 17 18:07:19 2006 +0000
2.2 +++ b/docs/reference.html Fri Mar 17 18:27:03 2006 +0000
2.3 @@ -16,7 +16,7 @@
2.4 attribute is used to translate the textual contents of an element to
2.5 another language where additional parameters specifying the language
2.6 and the whereabouts of the translations have been provided to the
2.7 -stylesheet in the output generation process.</p><p>Example:</p><pre><span template:i18n="-">Hello</span></pre><p>In this example, the contents of the <code>span</code> element would be replaced with an appropriate translation for the text <code>Hello</code><span></span>.</p><p>Example:</p><pre><span template:i18n="hello">Hello</span></pre><p>In this example, the contents of the <code>span</code> element would be replaced with an appropriate translation using the token <code>hello</code><span></span> as a key in the translation dictionary.</p><p>Syntax:</p><pre><span style="font-weight: bold;">-</span>|token</pre><p>See the <a href="internationalisation.html">"Internationalisation"</a> document for more information on this attribute.</p><h2>Initialisation Annotations</h2><p>The annotation attributes in this section control the initialisation of documents where this is done by the XSLForms toolkit.</p><h3><a name="init"></a>template:init</h3><p>This attribute controls the creation of elements in the initialisation process and is used together with <code>template:element</code>. For each element name listed in a <code>template:element</code> annotation, the corresponding value in a <code>template:init</code> annotation states whether or how such elements are to be initialised.</p><p>Example:</p><pre><p template:element="item" template:init="no"><br /> Such item elements will not be created automatically when the document is initialised.<br /></p></pre><p>Example:</p><pre><p template:element="first,second,third" template:init="yes,yes,no"><br /> The first and second elements will be created automatically when the document is initialised.<br /> No third elements will be created automatically when the document is initialised.<br /></p></pre><p>Syntax:</p><pre><span style="font-weight: bold;">yes</span>|<span style="font-weight: bold;">no</span>|<span style="font-weight: bold;">auto</span>[,<span style="font-weight: bold;">yes</span>|<span style="font-weight: bold;">no</span>|<span style="font-weight: bold;">auto</span>[,...]]</pre><p>Here, <code>yes</code> means that an element will be created automatically, <code>no</code> means that an element will not be created automatically (relying on the existence of such elements from before), and <code>auto</code>
2.8 +stylesheet in the output generation process.</p><p>Example:</p><pre><span template:i18n="-">Hello</span></pre><p>In this example, the contents of the <code>span</code> element would be replaced with an appropriate translation for the text <code>Hello</code><span></span>.</p><p>Example:</p><pre><span template:i18n="hello">Hello</span></pre><p>In this example, the contents of the <code>span</code> element would be replaced with an appropriate translation using the token <code>hello</code><span></span> as a key in the translation dictionary.</p><p>Example:</p><pre><span template:i18n="{$this-value}">Hello</span></pre><p>In this example, the value of the special template variable <code>$this-value</code> is used as a key in the translation dictionary.</p><p>Syntax:</p><pre><span style="font-weight: bold;">-</span>|<span style="font-weight: bold;">{</span>expression<span style="font-weight: bold;">}</span>|token</pre><p>See the <a href="internationalisation.html">"Internationalisation"</a> document for more information on this attribute.</p><h2>Initialisation Annotations</h2><p>The annotation attributes in this section control the initialisation of documents where this is done by the XSLForms toolkit.</p><h3><a name="init"></a>template:init</h3><p>This attribute controls the creation of elements in the initialisation process and is used together with <code>template:element</code>. For each element name listed in a <code>template:element</code> annotation, the corresponding value in a <code>template:init</code> annotation states whether or how such elements are to be initialised.</p><p>Example:</p><pre><p template:element="item" template:init="no"><br /> Such item elements will not be created automatically when the document is initialised.<br /></p></pre><p>Example:</p><pre><p template:element="first,second,third" template:init="yes,yes,no"><br /> The first and second elements will be created automatically when the document is initialised.<br /> No third elements will be created automatically when the document is initialised.<br /></p></pre><p>Syntax:</p><pre><span style="font-weight: bold;">yes</span>|<span style="font-weight: bold;">no</span>|<span style="font-weight: bold;">auto</span>[,<span style="font-weight: bold;">yes</span>|<span style="font-weight: bold;">no</span>|<span style="font-weight: bold;">auto</span>[,...]]</pre><p>Here, <code>yes</code> means that an element will be created automatically, <code>no</code> means that an element will not be created automatically (relying on the existence of such elements from before), and <code>auto</code>
2.9 means that the initialisation process will attempt to guess whether an
2.10 element should be created automatically (by looking for selectors which
2.11 use the element's name and only creating elements where no such