cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: [PATCH] I18nTransformer decimal and grouping locale
Date Tue, 20 May 2003 19:37:22 GMT
On Tue, 2003-05-20 at 20:20, Konstantin Piroumian wrote:
> Don't want to reopen this path, so replying to this message.
> 
> IMO, adding attributes for this kind of special cases is not a very good
> idea.
> It would be much better to define something like a <number-format/> or
> <currency-format /> element where you could define anything you need, e.g.:
> 
> <currency-format name="germans-for-americans>
>   <pattern>0.00##</pattern>
>   <decimal-separator>.</decimal-separator>
>   <group-separator>,</group-separator>
> </currency-format>
> 
> or something like this. And then use it with <i18n:currency/>:
> 
> <i18n:number type="currency" src-locale="en" format="germans-for-americans"
> value="27.24"/>

The i18n:number element already supports attributes such as pattern and
fraction-digits. It seems then only logical to also add 
decimal-seperator and group-seperator attributes. Adding a feature to
define reusable formats, like you propose above, is a different thing.

However, the knowledge of what the decimal-separtor and group-seperator
are for a certain locale is already present in the JRE for a large
number of locales. Why not reuse that as the dec-and-grp-locale
attribute is doing? Otherwise you'd have to define germans-for-* formats
for all countries in which you are selling.

One thing that on second sight seems less than ideal though is the name
of the "dec-and-grp-locale" attribute. Something like
"separators-locale" would be more readable.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Mime
View raw message