Hi Thiago,

If I want a way to make commonly used translators (and formatters) available to every component I can:

1. create a service and inject it into every component class and mark it a property

2. create my own binding prefix

am i missing something ? I would expect this to be easier, ie a way to contribute entries to the 'translate' binding prefix...

also, the other part of my question/suggestion is that it would be nice to be able to re-use translators as formatters.

I don't see why this wouldn't be possible since translators do the job of formatters.

p.

On 5/12/2010 4:18 AM, Thiago H. de Paula Figueiredo wrote:
On Sat, 04 Dec 2010 12:13:02 -0200, Paul Stanton <p...@mapshed.com.au> wrote:

I also can't find any documentation regarding the config of Translators ... ?

The contribution for TranslatorSource defines the default translator. If you want to use another one, just pass it to the translator parameter. You'll probably use the prop binding. Something like this:

<t:textfield ... t:translator="prop:fancyTranslator" />

public Translator getFancyTranslator() {
    return ...
}

If you use alternative translators a lot, you can create a binding for that, avoiding the methods to provide them.

You can't use a Translator directly as the format parameter to the Output component because it expects a java.text.Format instance. I prefer to do the formatting in the page or component class instead of using this component.


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

Reply via email to