Re: localization of keys returned as properties in T5

2008-02-07 Thread Howard Lewis Ship
I hope to extend the property expression language ASR (after stable
release) to allow more OGNL type things (such as passing parameters to
methods).

This could be accomplished as well by creating a custom binding
prefix, i.e., indirect-message:sender.address.addressLine1Label
which would resolve sender.address.addressLine1Label as a property
expression and then use that to lookup the message.

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/




-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: localization of keys returned as properties in T5

2008-02-07 Thread Josh Canfield
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.


localization of keys returned as properties in T5

2008-02-07 Thread Brian Long
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/


Re: localization of keys returned as properties in T5

2008-02-07 Thread Filip S. Adamsen
Have a look at 
http://wiki.apache.org/tapestry/Tapestry5HowToAddMessageFormatBindingPrefix 
- you'd have to change the messageKey String to a Binding and resolve 
that in the MessageFormatBinding, but then it would basically do what 
you're asking for.


-Filip

Brian Long skrev:

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/



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]