You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Lukasz Jazgar <lu...@gmail.com> on 2009/06/05 13:05:40 UTC
Expansions and translators
Hi,
When I have a page with property:
@Property
Double result;
and in template I use expansion:
Result is: ${result}
i get something like that: "123.456".
I'd rather expect "123,456" because of polish locale of my browser.
Same property shown in TextField has ',' so it is correctly localized.
Why?
As I see, in case of expansion, value of result property is converted
to String by type coercion mechanism (precisely by Object->String
coercion), which is locale-unaware. And in case of TextField, suitable
Translator (NumberTranslator) is used. NumberTranslator is
locale-aware.
I think, it's little bit inconsistent design. All values, which go to
(or from) client view, should be prepared by same mechanism, no matter
value is shown in form field or as a static text. And I think,
Translators are the mechanism invented just for this job.
So, I propose to change ExpansionPageElement.render() to use
translatorSource.findByType(..).toClient(..)
in place of
coercer.coerce(value, String.class)
What do you think?
Regards
Lukasz
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org