> Hi everyone!
>
> I started implementing internationalization in our XForms-based application
> and most obvious starting point was Orbeon's i18n how-to:
>
http://wiki.orbeon.com/forms/how-to/i18n>
> This requires writing all labels of controls in style similar to this:
> <xforms:label ref="$resources/registration/first-name"/>
>
> Orbeon's example was fine, but variables are not standard XForms feature and
> I wanted to use pure XForms markup as much as possible. Taking ideas from
> Wikibooks (see
>
http://en.wikibooks.org/wiki/XForms/Dynamic_Labels_in_Local_language) I
> modified Orbeon's example to use only standard XForms features (see attached
> i18n-xforms.zip). This requires writing labels like this:
> <xforms:label
> ref="instance('all-resources')/resources[@xml:lang=instance('language')]/registration/first-name"/>
>
> As you see, the XPath expression is much longer. This looks ugly and has
> possible performance drawbacks. I noticed that I could shorten the XPaths
> noticeably, if I put all languages into separate files. Taking also
> inpiration from XForms Essentials book
> (
http://xformsinstitute.com/essentials/browse/book.php#ch10-8-fm2xml) I made
> another round of modifications (see attached i18n-pepe.zip) and now labels
> started looking rather acceptable:
> <xforms:label ref="instance('resources')/registration/first-name"/>
>
> If you look into source code, then you could see that I used one
> non-standard XForms feature - AVT in xforms:submission's action attribute. I
> don't see this as a major problem, because firstly Chiba also supports this
> and secondly if Orbeon supported it, I would have used resource element
> under submission. This is XForms 1.1 feature, which allows you generate
> submission URL dynamically from instance data. Orbeon mentions that it
> wouldn't be hard to implement it, but currently it is not (see
>
http://wiki.orbeon.com/forms/doc/developer-guide/orbeon-forms-xforms-compliance-matrix).
>
> Finally I decided, that I don't need ability to switch languages on fly. The
> language is fixed in user's session and if user changes it, the page is
> anyway reloaded. So I removed everything that was related to dynamic
> language change, which made the form even simpler (see attached
> i18n-simple.zip). Notice that language is currently fixed in resource
> instance's src attribute, but you could easily overcome this by:
> 1) modifying the form on-fly before giving it to XForms engine (we use XSL
> stylesheets for that),
> 2) specifying in instance's src attribute an URL to a script, that returns
> correct resource file based on language in user's session. You might need to
> set up cookie forwarding for this to work (I've done that).
>
> Now the thing why I wrote this e-mail. I still don't like the solution,
> because simple form is now split into several files - form itself and
> resource file for each language. While this has good points (you can add new
> languages without modifying the original form), it makes deployment and
> distribution of forms much more hassle than it used to be. My dream would be
> that everything is in one file, simple and elegant (see attached
> i18n-deam.zip):
> 1) current language is indicated by xml:lang attribute of xhtml:html tag
> (you could use AVT in there in Orbeon):
> <xhtml:html xml:lang="en">
> 2) all labels have xml:lang attribute. Only those labels are shown, whose
> xml:lang matches that of xhtml:html element.
> <xforms:label xml:lang="en">First name</xforms:label>
> <xforms:label xml:lang="fr">Prénom</xforms:label>
>
> I think that I could implement that with pre-processing stylesheet, if
> changing language dynamically is not allowed.
>
> What is your take on this? Are there any drawbacks with some of the
> implementations, that I might have not thought of? Do you think my dream of
> simple internationalization of XForms will ever get implemented in Orbeon or
> in standard?
>
> Thanks for your attention,
> Tambet
>
>
> --
> You receive this message as a subscriber of the
[hidden email] mailing
> list.
> To unsubscribe: mailto:
[hidden email]
> For general help: mailto:
[hidden email]?subject=help
> OW2 mailing lists service home page:
http://www.ow2.org/wws>
>