You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Benoit Deshaies <bd...@yahoo.com> on 2004/07/20 23:55:26 UTC
[CForm] fd:repeater-action I18N problem
I think I found a problem with the repeater-action widget and I18N. The
final rendered page shows the I18N key name instead of the translated
value. In my form, I define the widget like so:
<fd:repeater-action ...>
<fd:label><i18n:text>button.add</i18n:text></fd:label>
</fd:repeater-action>
In my sitemap, I generate the template, run the form transformer, run
the I18N transformer, style then serialize. Just like the samples. In
the displayed page, my repeater-action buttons have the name of the
i18n key, e.g. button.add, instead of the value of that key.
Looking at forms-field-styling.xsl, it became obvious why: the action's
label is put into <input> value without any concern for I18N.
I replaced the action template with the following to solve the problem.
<!--+
| fi:action
+-->
<xsl:template match="fi:action">
<input id="{@id}" type="submit" name="{@id}" title="{fi:hint}">
<xsl:if test="fi:label/i18n:text">
<xsl:attribute name="i18n:attr">value</xsl:attribute>
</xsl:if>
<xsl:attribute name="value"><xsl:value-of
select="fi:label/node()"/></xsl:attribute>
<xsl:apply-templates select="." mode="styling"/>
</input>
</xsl:template>
And of course, don't forget to add the I18N namespace on the root
element of the xsl.
I'd like your opinion:
1. Was I doing something wrong putting i18n:text in the label?
2. What's the best solution to fix this? I don't find mine very
elegant.
Thanks.
Benoit
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForm] fd:repeater-action I18N problem
Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2004-07-20 at 23:55, Benoit Deshaies wrote:
> I think I found a problem with the repeater-action widget and I18N. The
> final rendered page shows the I18N key name instead of the translated
> value. In my form, I define the widget like so:
>
> <fd:repeater-action ...>
> <fd:label><i18n:text>button.add</i18n:text></fd:label>
> </fd:repeater-action>
>
> In my sitemap, I generate the template, run the form transformer, run
> the I18N transformer, style then serialize. Just like the samples. In
> the displayed page, my repeater-action buttons have the name of the
> i18n key, e.g. button.add, instead of the value of that key.
>
> Looking at forms-field-styling.xsl, it became obvious why: the action's
> label is put into <input> value without any concern for I18N.
>
> I replaced the action template with the following to solve the problem.
> <!--+
> | fi:action
> +-->
> <xsl:template match="fi:action">
> <input id="{@id}" type="submit" name="{@id}" title="{fi:hint}">
> <xsl:if test="fi:label/i18n:text">
> <xsl:attribute name="i18n:attr">value</xsl:attribute>
> </xsl:if>
> <xsl:attribute name="value"><xsl:value-of
> select="fi:label/node()"/></xsl:attribute>
> <xsl:apply-templates select="." mode="styling"/>
> </input>
> </xsl:template>
>
> And of course, don't forget to add the I18N namespace on the root
> element of the xsl.
>
> I'd like your opinion:
> 1. Was I doing something wrong putting i18n:text in the label?
certainly not
> 2. What's the best solution to fix this? I don't find mine very
> elegant.
It isn't clear from the description of your pipeline since it doesn't
mention the XSL, but if you do the I18N-transform before the XSL
transform then everything should work fine.
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org bruno@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [CForm] fd:repeater-action I18N problem
Posted by Joerg Heinicke <jo...@gmx.de>.
On 20.07.2004 23:55, Benoit Deshaies wrote:
> I think I found a problem with the repeater-action widget and I18N. The
> final rendered page shows the I18N key name instead of the translated
> value. In my form, I define the widget like so:
>
> <fd:repeater-action ...>
> <fd:label><i18n:text>button.add</i18n:text></fd:label>
> </fd:repeater-action>
>
> In my sitemap, I generate the template, run the form transformer, run
> the I18N transformer, style then serialize. Just like the samples. In
> the displayed page, my repeater-action buttons have the name of the
> i18n key, e.g. button.add, instead of the value of that key.
>
> Looking at forms-field-styling.xsl, it became obvious why: the action's
> label is put into <input> value without any concern for I18N.
>
> I replaced the action template with the following to solve the problem.
> <!--+
> | fi:action
> +-->
> <xsl:template match="fi:action">
> <input id="{@id}" type="submit" name="{@id}" title="{fi:hint}">
> <xsl:if test="fi:label/i18n:text">
> <xsl:attribute name="i18n:attr">value</xsl:attribute>
> </xsl:if>
> <xsl:attribute name="value"><xsl:value-of
> select="fi:label/node()"/></xsl:attribute>
> <xsl:apply-templates select="." mode="styling"/>
> </input>
> </xsl:template>
>
> And of course, don't forget to add the I18N namespace on the root
> element of the xsl.
>
> I'd like your opinion:
> 1. Was I doing something wrong putting i18n:text in the label?
> 2. What's the best solution to fix this? I don't find mine very
> elegant.
No, your way putting i18n:text in the label is absolutely correct. I
have done it the same way. But for getting resolved these labels you
need to add the i18n transformer twice into the pipeline: once before
the stylesheet and once after.
I also do not find your solution very elegant ;-)
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org