On Sunday 15 January 2006 21:18, Jason Johnston wrote: > Steinar Jonsson wrote: > > 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"); > > I believe that if the value of the "label" path is a > org.apache.cocoon.forms.util.I18nMessage (see the javadocs) then it will > write out the label surrounded by the appropriate i18n tags.
I may be wrong, but I somehow got the impression that would only work if the entire label text is an i18n key. In my case each label typically has a prefix part that should be translated and a name part that should not. > > Another solution would be to create a SelectionList object (again, see > the javadocs... some SelectionList implementations allow i18n-ized > labels) and use the SelectableWidget.setSelectionList(SelectionList s) > method. > Thanks, I will look into that. Steinar --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
