Thanks, that's what I was missing!! A translator can be supplied as a page
property for per-field use!
One doesn't need to contribute a custom translator in AppModule unless one
wants it to apply universally to a custom type and wants to avoid repeatedly
specifying the "translate".
It would be good to clarify this in the docs. I don't see it described
anywhere; I see only examples of the contributed-custom-type case. (And
it's different from the way Tapestry 3 and 4 did it.)
Details: In the tml:
<t:textfield t:id="annualSales" value="company.annualSales"
translate="prop:currency"/>
In the java (actually in my Page super-class):
public FieldTranslator<BigDecimal> getCurrency()
{
return new CurrencyTranslator();
}
Where CurrencyTranslator implements FieldTranslator<BigDecimal>.
On Sun, Dec 27, 2009 at 3:37 PM, Thiago H. de Paula Figueiredo <
[email protected]> wrote:
> Em Sun, 27 Dec 2009 17:58:07 -0200, Bryan Lewis <[email protected]>
> escreveu:
>
> Really? I wish that was my experience. Here's what I'm seeing; maybe you
>> can point out what I've done wrong.
>> <t:textfield t:id="annualSales" value="company.annualSales"
>> t:translate="bigdecimal"/>
>>
>
> Have you tried t:translate="prop:salesTranslator" and a Translator
> getSalesTranslator() in your class?
>
> TapestryModule already creates a translator for BigDecimal, so I guess
> yours is ignored. I agree that the source of translators should be improved.
>
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, software architect and developer, Ars Machina Tecnologia da
> Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>