W3C home > Mailing lists > Public > www-forms@w3.org > July 2010

Re: XForms i18n

From: Tambet Matiisen <tambet.matiisen@gmail.com>
Date: Wed, 21 Jul 2010 00:09:24 +0300
Message-ID: <4C461084.3060505@gmail.com>
To: www-forms@w3.org
While certainly conforming to standard, this approach is much more 
verbose than the one proposed in original e-mail. I remember discussion, 
that XForms schema allows <xforms:label> several times inside control 
exactly for this reason - to allow labels, help texts and alerts in 
multiple languages. Do future versions of XForms specifications address 
this issue? Does any of the implementations already support xml:lang 
attribute for labels?

Thanks in advance,
  Tambet

Swithun Crowe wrote:
> Hello
>
> KB> What I want: one document containing data, layout and translations. 
> KB> Splitting into several documents is no option.
>
> I don't know if the naive approach will work, though it would be nice if 
> it did.
>
> What you could do is have three extra instances. One will hold a list of 
> possible languages. Another will hold the selected language. And the third 
> will hold all your I18N strings. Something like:
>
> <xf:instance id="langs">
>   <langs xmlns="">
>     <lang id="en_US">American English</lang>
>     <lang id="de_DE">Deutsch</lang>
>     ...
>   </langs>
> </xf:instance>
>
> <xf:instance id="lang">
>   <lang xmlns="">en_US</lang>
> </xf:instance>
>
> <xf:instance id="strings">
>   <strings xmlns="">
>     <string lang="en_US" name="label">Label</string>
>     <string lang="de_DE" name="label">Aufkleber</string>
>     ...
>   </strings>
> </xf:instance>
>
> And then have a select1 control where the user selects their preferred 
> language:
>
> <xf:select1 ref="instance('lang')">
>   <xf:label>Select language</xf:label>
>   <xf:itemset nodeset="instance('langs')/lang">
>     <xf:label ref="."/>
>     <xf:value ref="@id"/>
>   </xf:itemset>
> </xf:select1>
>
> and then for your internationalised controls, have something like:
>
> <xf:select1 ref="/my/model/some_value">
>   <xf:label ref="instance('strings')/string[@lang=instance('lang')][@name='label']"/>
>   ...
> </xf:select1>
>
> I haven't tested the code, but something along those lines should work. I 
> agree it doesn't give special status to the @lang attribute, so there 
> might be a better approach where the browser/implementation does the work.
>
> Swithun.
>
>   
Received on Tuesday, 20 July 2010 22:11:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:20 GMT