It seems a little strange to me to store resource keys in your objects...
but I suppose I could imagine a situation where that'd be the most
convenient thing to do.

I don't believe there is a binding to fit your needs built-in, but it's
something you could add. Check out
http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefix for an
example.

Josh

On Feb 7, 2008 8:32 AM, Brian Long <[EMAIL PROTECTED]> wrote:

> Sorry about the ambiguous title, but I'll try to explain what it is I'm
> trying to achieve . . .
>
> in T4 it's possible to have properties/keys in an object that can be
> localized in the html file using the following expression
>
> <span [EMAIL PROTECTED] value="ognl:messages.getMessage(
> sender.address.addressLine1Label)">AddressLine1</span>
>
> tapestry will resolve what the contents of "
> sender.address.addressLine1Label"
> are before trying to find a match for that key in the appropriate
> .properties file.
>
> however in T5 we no longer have ognl: prefix (I'm guessing it's replaced
> by
> prop:?), so I tried (unsuccessfully) using certain combinations of the
> prop:
> and message: prefix to first extract the key from the required object
> before
> trying to localize it. The only solution I could come up with was to
> inject
> the messages bean into my class and add a method that can pass the key
> into
> my messages bean and return the localized text. This method is then called
> from the .tml. Ideally however I would like to find a way to do all of
> this
> work in my .tml file, so if anyone has any ideas, comments or criticism,
> please let me know.
>
> Regards, Brian.
>
>    @Inject
>    private Messages messages;
>
>    public final String getSenderAddressLine1Label() {
>        return messages.get(moneyTransfer.getSender
> ().getAddress().getAddressLine1Label());
>    }
>
>    <t:label t:for="senderAddressLine1"/>
>    <input t:type="textfield" t:id="senderAddressLine1" t:value="
> sender.address.addressLine1" t:label="prop:senderAddressLine1Label"
> size="30" disabled="readOnly"/>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Reply via email to