$form-resources and $fr-resources

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

$form-resources and $fr-resources

bwallis42
Just a bit curious, what do these point to? I assume they are setup for the form runner and also that $form-resources is a reference to instance('fr-form-resources') (is that correct?) but what does $fr-resources reference?

thanks,
brian...
Reply | Threaded
Open this post in threaded view
|

Re: $form-resources and $fr-resources

bwallis42
Forgot to add

Can I use these in the same way from within an XBL control? I'm taking a common collection of controls in an existing form and creating an XBL control from them but am not sure about what to do with these references (I haven't tried to run my control yet).

thanks
brian...
Reply | Threaded
Open this post in threaded view
|

Re: $form-resources and $fr-resources

Alessandro  Vernet
Administrator
Hi Brian,

- $form-resources points to the form's resources in the current language (e.g. selected with the language picker).
- $fr-resources points to the Form Runner resources in the current language. Those come from:

https://github.com/orbeon/orbeon-forms/blob/master/form-runner/jvm/src/main/resources/apps/fr/i18n/resources.xml

In general, an XBL control shouldn't rely on the form's resources, as you typically don't want XBL controls to have a dependency on the form where they are used. If you're not worried about your component having a dependency on Form Runner, you can refer to the Form Runner resources using xxf:r() (see doc linked). To access a top-level instance, use something like: xxf:r('components.wizard.edit', '|fr-fr-resources|').

https://doc.orbeon.com/xforms/xpath/extension-core.html#xxfr

Note the pipes in the instance name; they allow you to access to access an instance outside of the XBL component, and thus break encapsulation. For this reason, this use is undocumented, but we use this in build-in XBL components that are not expected to be used outside of Form Runner.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: $form-resources and $fr-resources

bwallis42
Thanks Alex,
    Is there a similar convention for resources inside an XBL control for labels and the like?

brian...
Reply | Threaded
Open this post in threaded view
|

Re: $form-resources and $fr-resources

Alessandro  Vernet
Administrator
Hi Brian,

You can use the `lang` attribute on a LHHA attribute, as done here:

https://github.com/orbeon/orbeon-forms/blob/tag-release-2016.3-ce/src/main/resources/xbl/orbeon/autocomplete/autocomplete.xbl#L83

Or you can have a "local" instance, and use `xxf:r()`, as in:

https://github.com/orbeon/orbeon-forms/blob/tag-release-2016.3-ce/src/main/resources/xbl/orbeon/wpaint/wpaint.xbl#L127

Does one of those techniques work for you?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet