cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steinar Jonsson <sjons...@online.no>
Subject Re: CForms, double-listbox and i18n.
Date Sun, 15 Jan 2006 13:59:10 GMT
On Sunday 15 January 2006 10:41, Sylvain Wallez wrote:
> Steinar Jonsson wrote:
> > Hi
> >
> > I have a little i18n problem in 2.1.8:
> >
> > A form contains a double-listbox that I insert string values into
> > from javaflow.
> >
> > Some value strings have content that I want the i18n transformer
> > to translate. If I just add i18n tags to the strings they are not
> > transformed.
> >
> > What is the correct way to do this?
>
> You say you're "inserting string values into" the selection-list. What
> implementation of selection-list do you use?
>

First, it's not a double-listbox as I wrote above, I had another problem 
in my head at the same time and they got mixed up, sorry. (Though I 
suspect listbox or double-listbox makes no difference in this case)

Here's what I do in the java class :

import org.apache.cocoon.forms.formmodel.SelectableWidget;
....
        SelectableWidget widget = (SelectableWidget)form.getChild(widgetName);
        widget.setSelectionList(listOfLabelAndValuePairs, "value", "label");

Form definition contains :
    <fd:field id="accesses">
      <fd:label></fd:label>
      <fd:datatype base="string"/>
      <fd:selection-list/>
    </fd:field>

and template :
              <ft:widget id="accesses">
                <fi:styling list-type="listbox" listbox-size="23">
                </fi:styling>
              </ft:widget>

display pipeline looks like this:
        <map:generate 
            src="pages/cform/{request-param:pagename}/{request-param:pagename}-template.xml"/>
        <map:transform type="forms"/>
        <map:transform type="i18n">
          <map:parameter name="locale" value="{global:locale}"/>
        </map:transform>
        <map:serialize type="xml"/>

and is aggregated into:
        <map:transform src="layouts/default/xsl/layout.xsl">
          <map:parameter name="template" value="../xml/layout.xml"/>
        </map:transform>
        <map:transform src="styles/{request-param:style}/xsl/forms-samples-styling.xsl"/>
        <map:transform type="i18n">
          <map:parameter name="locale" value="{global:locale}"/>
        </map:transform>
        <map:serialize/>

My "forms-samples-styling.xsl" is basically a copy of the one supplied with cocoon.

Does this make sense?

Steinar


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message