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

i18n, componentized forms and multiple models

From: Townley, Andrew <andrew.townley@bearingpoint.com>
Date: Fri, 21 Jul 2006 12:44:44 +0100
Message-ID: <199CA7C85B920D4F90FD83CA09A99518293B98@becxoex01.corp.kpmgconsulting.com>
To: <www-forms@w3.org>

Hi everyone,

I'm trying to get started with XForms, and I was wondering what the collective wisdom of the group would be in the following situation.  What I would like to end up with is modular content which can be created by different authors and then aggregated together into complete forms.

Right now, I'm playing around with a simple form that leverages the "Dynamic Selections" technique from T.V. Raman's book for populating select and select1 controls.  To me, it should be possible to have the models separately created with appropriate i18n support thus:

<ListItems>
  <Item Code="1234">
    <Label xml:lang="en">English</Label>
    <Label xml:lang="fr">French</Label>
    ...
  </Item>
</ListItems>

I have this part working fine in my example using two such selection lists, but where I'm a bit stuck is that I also would ideally like to have a separate model which stores the language preference for the user.  No matter what I've tried, I can't seem to be able to dynamically evaluate something sensible for:

<xforms:select ...>
  <xforms:itemset model="List1" nodeset="/ListItems/Item">
    <xforms:label ref="Label[lang(????)]"/>
    <xforms:value ref="@Code"/>
  </xforms:itemset>
</xforms:select>

Of course, it will work if I hard-code 'en' or 'fr', but that kinda defeats the point, I would've thought.  I realize that the XPath context is relative to the current model, so I tried embedding the language setting as an instance in the model.  This works, but doesn't get me where I want to be.

Maybe I'm missing something terribly obvious here, but I can't find a good solution in either Raman's or Dubinko's books.  None of the i18n approaches mentioned don't seem to have the appropriate levels of indirection that I need to do dynamic discovery of the language preferences from a central place.

The rationale that led me to this line of thinking was that I could pre-process the form as it was being sent to the renderer to capture the user's language and accessibility preferences one time.  This single value would then be used to dynamically resolve the appropriate l10n value for each of the items.  This approach would then allow me to modularize all of the content chunks as a unit so that there wasn't one massive set of resources for all of the possible content chunks.  If you wanted to add or remove a module (content chunk, selection or whatever), you could do this fairly easy--at least to my line of thinking.  It would also, ideally, allow me to put a common control on the form which would allow the user to explicitly toggle their language preferences and have the rest of the form react accordingly.

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.

Any assisitance would be most appreciated.

Thanks in advance,

ast
***************************************************************************************************
The information in this email is confidential and may be legally privileged Access to this email by anyone other than the intended addressee is unauthorized. If you are not the intended recipient of this message, any review, disclosure, copying, distribution, retention, or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful. If you are not the intended recipient, please reply to or forward a copy of this message to the sender and delete the message, any attachments, and any copies thereof from your system.
***************************************************************************************************
Received on Friday, 21 July 2006 11:45:18 GMT

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