You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Gentry <mg...@masslight.net> on 2009/08/27 19:50:03 UTC

T5.1: Nested/indrect message: values

Hi everyone,

I'm trying to use the message catalog to look up values in a loop.  I
have a List of enums and bind the loop's source to contentAreas and
the value to contentArea.  I'm then trying to extract a value from the
message catalog with:

${message:${contentArea}-name}

I was hoping ${contentArea} would get replaced by the value of my enum
(let's say FOO) and get substituted so that it then did a
${message:FOO-name}, but instead I get this error:

[[missing key: ${contentArea.name]]-name}

I also tried: ${message:${contentArea}}

My .properties file looked something like this:

FOO = Some Value
FOO-name = Some Value

Can this be done?

Thanks,

mrg

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


Re: T5.1: Nested/indrect message: values

Posted by Michael Gentry <mg...@masslight.net>.
If anyone cares, this is how I'm currently doing it.

.java:

    @Inject
    private Messages messages;

    public String getEnumName(Enum<?> e)
    {
        return messages.get(e + ".name");
    }

.tml:

${getEnumName(contentArea)}

mrg


On Fri, Aug 28, 2009 at 8:49 AM, Michael Gentry<mg...@masslight.net> wrote:
> Yeah, this is what I'm currently doing, but I thought there might be a
> way to do it in the template.
>
> Thanks,
>
> mrg
>
>
> On Fri, Aug 28, 2009 at 6:45 AM, Sebastian
> Hennebrueder<us...@laliluna.de> wrote:
>> You may provide a @Property for your current loop value
>> and a
>> public String getMyMessage() method which builds the key and returns the
>> message from the bundle using this key.
>>
>

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


Re: T5.1: Nested/indrect message: values

Posted by Michael Gentry <mg...@masslight.net>.
Yeah, this is what I'm currently doing, but I thought there might be a
way to do it in the template.

Thanks,

mrg


On Fri, Aug 28, 2009 at 6:45 AM, Sebastian
Hennebrueder<us...@laliluna.de> wrote:
> You may provide a @Property for your current loop value
> and a
> public String getMyMessage() method which builds the key and returns the
> message from the bundle using this key.
>

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