- From: Erik Bruchez <ebruchez@orbeon.com>
- Date: Mon, 24 Jul 2006 16:29:07 +0200
- To: www-forms@w3.org
Andrew, > I'm testing the form on both Orbeon's Presentation Server (current > release) along with Mozilla XForms 0.5 (0.6 said it had an invalid > checksum and wouldn't install for me) in case it matters. I don't > really think it does, because one of the points in Dubinko's book > was "options for cross-model communication are limited." > Unfortunately, I can't find much on what those options are. I > suppose I could resort to using some JavaScript to solve the > problem, but I would really rather not do it that way. If you download the latest OPS nightly build [1], go to the DMV Forms example, and open a form, you will see there what I think is a really cool illustration of i18n with a dropdown allowing you to switch at runtime between English and French resources (he he, this is not something you see often, to say the least, and XForms makes it a breeze to achieve). As suggested by others, simply load your initial resources into an instance (alternatively, you can run a submission upon xforms-ready): <xforms:instance id="resources-instance" src="resources_en.xml"/> There is another instance holding the current language: <xforms:instance id="language-instance"> <language xmlns="">en</language> </xforms:instance> There is an xforms:select1 to change the language: <xforms:select1 ref="instance('language-instance')"> <xforms:label ref="instance('resources-instance')/labels/language-choice"/> <xforms:item> <xforms:label>en</xforms:label> <xforms:value>en</xforms:value> </xforms:item> <xforms:item> <xforms:label>fr</xforms:label> <xforms:value>fr</xforms:value> </xforms:item> <xforms:send ev:event="xforms-value-changed" submission="update-language-submission"/> </xforms:select1> which runs a submision that updates the resources: <xforms:submission id="update-language-submission" ref="instance('language-instance')" action="/forms/service/resources/{.}" validate="false" method="get" replace="instance" instance="resources-instance"/> All the internationalized resources in the page are referred to with things like: <xforms:output ref="instance('control-instance')/message"/> <xforms:label ref="instance('resources-instance')/labels/language-choice"/> This is much more flexible than to hardcode xml:lang in the page, and it works like a charm. I hope this helps, -Erik [1] http://forge.objectweb.org/nightlybuilds/ops/ops/ -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/
Received on Monday, 24 July 2006 14:29:13 UTC