Great, thanks, that solves my problem.

My confusion was that I had not realized that I would get the same exception 
even without contributing or referencing any translator, because I was binding 
my TextField to a Date and not to a String so a translator was needed in any 
case.



My goal is that only TextFields having the t:translate="dateTranslator"  
attribute in the tml get translated, and TextFields that don’t have such 
attribute should keep behaving as they did before (in this case throw an 
exception if I bind that field to a Date). So I will keep contributing my 
translator by name to TranslatorAlternativesSource and use t:translate in the 
tml; then if I want a TextField to show a “non-translated” date I will not give 
that field the t:translate attribute and I will bind that field to a String 
instead of a Date, and I will provide a String representation of my Date as the 
field’s value instead of providing the Date itself.





-----Original Message-----
From: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com]
Sent: Thursday, April 30, 2015 22:52
To: Tapestry users
Subject: Re: Exception "Parameter 'translate' of component is bound to null" on 
a field that has no 'translate' attribute.



On Thu, 30 Apr 2015 12:58:23 -0300, Lance Java 
<lance.j...@googlemail.com<mailto:lance.j...@googlemail.com>>

wrote:



> If you want tapestry to use your translator as the default for all

> dates you should contribute to TranslatorSource using a class (instead

> of contributing by name to TranslatorAlternativesSource).

>

> Otherwise, you could annotate individual date fields with

> @Translate("dateTranslator") and leave your code as is.



Exactly. TextField needs a translator to convert between the edited property 
type and String and vice-versa. Tapestry provides translators for numeric types 
and String itself. In your case, you're editing a Date, so you need to provide 
a translator for Date through TranslatorSource or the translate parameter 
explicitly.



--

Thiago H. de Paula Figueiredo

Tapestry, Java and Hibernate consultant and developer http://machina.com.br



---------------------------------------------------------------------

To unsubscribe, e-mail: 
users-unsubscr...@tapestry.apache.org<mailto:users-unsubscr...@tapestry.apache.org>

For additional commands, e-mail: 
users-h...@tapestry.apache.org<mailto:users-h...@tapestry.apache.org>


Reply via email to