I don't have a great answer, but since you asked again... I had a similar surprise a year ago because I was expecting things to work as they did in Tap4: http://www.mail-archive.com/users@tapestry.apache.org/msg39593.html
But someone (Thiago probably) pointed out that it wasn't so hard to specify the desired translator on each instance of a textfield: <t:textfield value="bigDecimalValue" translate="prop:currencyTranslator"/> My base Page class has a getCurrencyTranslator() method that merely does "return new CurrencyTranslator();". Since then, I wrote an Insert component (reusing a Tap4 name we were accustomed to) that allows me to pass my translators to an output string, something like your "reuse as formatter" objective. I can say: <t:insert value="bigDecimalValue" translate="currencyTranslator"/> and reuse my translator's formatting code. On Tue, Dec 21, 2010 at 9:29 PM, Paul Stanton <p...@mapshed.com.au> wrote: > anyone? > > On 5/12/2010 10:59 AM, Paul Stanton wrote: > >> 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 >> >> >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >