allow Translators to be registered by name and used as Formatters
-----------------------------------------------------------------

                 Key: TAP5-1365
                 URL: https://issues.apache.org/jira/browse/TAP5-1365
             Project: Tapestry 5
          Issue Type: Improvement
    Affects Versions: 5.2.4
            Reporter: Paul Stanton


It's my understanding that a regression between version 5.1 and 5.2 meant that 
it is no longer possible to register translators by name (without some extra 
plumbing) via the 'translate' binding prefix.

Instead you can override the default Translator for a particular type meaning 
you can have one translator per type.

This means that the 'translate' binding prefix is perhaps redundant, since the 
translator could be selected by value type.

I might be incorrect in my understanding but either way, I'd appreciate the 
discussion on the benefits of my suggested approach.

What I suggest is at least a partial return to the old model whereby you could 
register a translator by name and for example have a 'date-long' translator and 
a 'date-short' translator co-exist, or a 'decimal-2dp' and a 'decimal-3dp' 
translator. you would then select the appropriate translator via the parameter 
binding

<t:textfield value="myDecimal" translator="translate:decimal-2dp" />

Secondly, since Translators are capable of converting objects to text, there 
should be no reason why they couldn't be re-used as formatters, so you could 
also use

<t:output value="myDate" format="translate:date-long" />

The inclusion of both of these features would allow a developer to create one 
set of Translators which are responsible for all object-to-text and 
text-to-object conversions throughout an application, thereby avoiding 
repetitive coding.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to