You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sub <b4...@nwldx.com> on 2012/01/23 16:54:41 UTC
"message:" binding with dynamic param in template
Hi!
I'm trying to use a parameter with the message binding expression to get the
translation from my properties file:
messages.properties:
color.red=rot
color.blue=blau
template:
<t:loop source="colors" value="color">
${message:color.${color}}
</t:loop>
instead of "rot" I get "${message:color.red}" as the output.
What's the correct syntax to get this working? Or do I need a complete
different approach?
Cheers,
sub
--
View this message in context: http://tapestry.1045711.n5.nabble.com/message-binding-with-dynamic-param-in-template-tp5166481p5166481.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: "message:" binding with dynamic param in template
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 23 Jan 2012 13:54:41 -0200, sub <b4...@nwldx.com> wrote:
> Hi!
Hi!
> I'm trying to use a parameter with the message binding expression to get
> the translation from my properties file:
>
> messages.properties:
>
> color.red=rot
> color.blue=blau
>
> template:
>
> <t:loop source="colors" value="color">
> ${message:color.${color}}
> </t:loop>
>
> instead of "rot" I get "${message:color.red}" as the output.
>
> What's the correct syntax to get this working? Or do I need a complete
> different approach?
There's no syntax for what you're trying to do.
As always, when there's logic, do it in Java, not in the template:
@Inject
private Messages messages;
public String getColorName() {
return messages.get("color." + color);
}
<t:loop source="colors" value="color">
${colorName}
</t:loop>
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org