You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Filip S. Adamsen" <fs...@fsadev.com> on 2007/09/07 18:15:30 UTC

[T5] New HowTo: Adding a messageformat binding prefix

http://wiki.apache.org/tapestry/Tapestry5HowToAddMessageFormatBindingPrefix 
describes how to add a messageformat prefix that allows you to do this:

   ${messageformat:key,value1,value2}

or this:

   <t:component parameter="messageformat:key,value1,value2"/>

in your templates.

It uses org.apache.tapestry.ioc.Messages#format with the given key and 
value(s) to return a localized, formatted message.

The values can be literal if enclosed in single quotes or use any other 
binding prefix to retrieve a value - default prefix is prop.

Comments and suggestions for improvement are welcome.

-Filip

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


Re: [T5] New HowTo: Adding a messageformat binding prefix

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
I've made an update to fix a nasty bug that basically makes the whole 
thing blow up if you have any non-literal bindings as values.

I had to add a new class, MessageFormatBinding, to fix this. While I was 
at it I also changed the format of the binding to 
"messageformat:key=value1,value2".

The whole thing can be found at:
http://wiki.apache.org/tapestry/Tapestry5HowToAddMessageFormatBindingPrefix

-Filip

Filip S. Adamsen skrev:
> http://wiki.apache.org/tapestry/Tapestry5HowToAddMessageFormatBindingPrefix 
> describes how to add a messageformat prefix that allows you to do this:
> 
>   ${messageformat:key,value1,value2}
> 
> or this:
> 
>   <t:component parameter="messageformat:key,value1,value2"/>
> 
> in your templates.
> 
> It uses org.apache.tapestry.ioc.Messages#format with the given key and 
> value(s) to return a localized, formatted message.
> 
> The values can be literal if enclosed in single quotes or use any other 
> binding prefix to retrieve a value - default prefix is prop.
> 
> Comments and suggestions for improvement are welcome.
> 
> -Filip

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


Re: [T5] New HowTo: Adding a messageformat binding prefix

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Nice!

Cheers,
Nick.


Filip S. Adamsen wrote:
> http://wiki.apache.org/tapestry/Tapestry5HowToAddMessageFormatBindingPrefix 
> describes how to add a messageformat prefix that allows you to do this:
> 
>   ${messageformat:key,value1,value2}
> 
> or this:
> 
>   <t:component parameter="messageformat:key,value1,value2"/>
> 
> in your templates.
> 
> It uses org.apache.tapestry.ioc.Messages#format with the given key and 
> value(s) to return a localized, formatted message.
> 
> The values can be literal if enclosed in single quotes or use any other 
> binding prefix to retrieve a value - default prefix is prop.
> 
> Comments and suggestions for improvement are welcome.
> 
> -Filip
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

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