Hi,
On 2008-04-03 11:26, Andy Blower wrote:
Filip - that looks really good work.
I didn't realise new bindings can be created. I'm surprised that you're
using %d, %s etc rather than the standard {0} {1} ResourceBundle parameters.
To me it would be nicer expressed like this: (can you overload bindings?)
That's because it's the format Tapestry itself uses for its message
bundles. I'm actually using Tapestry's message binding under the covers.
I suppose one could change this without too much hassle if needed.
And you can't override the message prefix. That's why I called mine
'messageformat'. I'm actually using 'format' in my own applications.
Overloading, if I understand you correctly, is just a matter of
processing the binding expression in your binding.
${message:key(param0,param1,...,paramN)}
The other thing is can the params be the strings from other messages? This
is something I've done a fair amount in JSP & JSTL to reduce duplication of
translated text in properties files.
It sure can. The MessageFormatBindingPrefix supports that natively, like
this (values with no prefix default to prop: unless they're
single-quoted, in which case they're taken as literals):
${format:key-name=message:other-key,'1',productname}
So if you add a new binding it can be used in there as well. Again, I'm
just building this on top of Tapestry's binding prefix support.
I'm really not quite sure what "making the message key itself a binding"
would mean or how it would help, sorry if it's obvious but I'm very new to
Tapestry. I'll certainly not be doing it myself any time soon, I'm just
evaluating the framework at the moment.
What I mean is that you could have this:
${format:prop:property='whatever','properties','you','need','etc'}
Thanks,
Andy.
-Filip
Filip S. Adamsen-2 wrote:
I've been thinking about adding support for this to the
MessageFormatBindingPrefix found on this wiki page:
http://wiki.apache.org/tapestry/Tapestry5HowToAddMessageFormatBindingPrefix
If you take a look at it the code, MessageFormatBindingFactory in
particular, you'll see that making the message key itself a binding
wouldn't be too difficult. It should probably default to literal to
preserve current behaviour, though.
You can have a go at it yourself or wait a few days for me to do it.
-Filip
On 2008-04-02 20:43, Andy Blower wrote:
I'm accessing message catalogs using expansion with a prefix. e.g.
${message:this-is-my-key}
1) Is there a list of prefixes anywhere, or have I got them all now?
(literal, prop, message)
2) Is there a way of accessing a message with a key that's partially
generated by another expansion?
e.g. (this doesn't work obviously, but getProductVariant() is implemented
in
the page class and its output forms the last segment of the message key)
${message:product-name-${productVariant}}
3) Also how can you pass arguments to the messages to replace {0}, {1}
etc?
Thanks,
Andy.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]