[development] code proposal: localization of currency, ...
Ivan Sergio Borgonovo
mail at webthatworks.it
Wed Oct 17 19:48:55 UTC 2007
On Wed, 17 Oct 2007 19:52:33 +0200
Wim Leers <work at wimleers.com> wrote:
> My Money CCK field module  already supports portions of the
> desired functionality:
> 1) You can choose whatever currency you want to store your amount
> in. 2) You can choose the digit group separator and the decimal
> separator. 3) Two formatters are offered: currency code
> before/after the amount.
I gave a look at the code. I think something a bit more generalised
could gain more acceptance. I'm thinking about position of the sign
and relaying on a more general number format.
People may not want to follow ISO but just output their stuff
accordingly to traditions.
> It's not a Drupal core solution, but it is a solution.
I'm not expecting to get into core. I just would like to make my
solution easier to maintain.
If people would start to build up modules that wrap currency/float
format function we may end up in making i18n easier.
Same for float/large numbers.
I'm not aware of how many modules output something that's not simple
integers (and even large integers may have to be formatted...) but it
looks like a must have feature.
I think that a reasonably general solution can be found and people
could tune it in a setting page as they would do with the date format
There are 2 currencies that are a bit tricky to format (non decimal
ones) the rest is just a matter of providing a date alike string that
could tell where to put sign and currency symbol.
Number format could be inherited by the number formatting format.
I'm not aware of any other strangeness other than grouping by
hundreds other than thousands and using different char as separator
As for currencies just 2 currencies can't be expressed in a
meaningful way other than in their "native" format.
Others can be "adapted".
What I mean is that Italian expect to read
as well as
while US people expect to read
If we want to be really tough we could provide 3 number format for
This would make this stuff pretty general and when modules will have
to output numbers they will have the correct format in most of the
In *many circumstances* people won't tolerate that numbers/currencies
don't get displayed in their local format.
Editing all the contrib modules to retro-fit them to support
localisation of format may be a PITA.
If people think that their output doesn't have to be "localised" they
could avoid to wrap their output with these functions as I think they
are already doing when there is no purpose for using t().
Something that provide this base functionality is due. Gluing it
together with i18n shouldn't be a problem.
Function naming/signature and how much it has to be general will
decide its acceptance.
I'm still open to advices.
Ivan Sergio Borgonovo
More information about the development