[development] code proposal: localization of currency, ...

Wim Leers work at wimleers.com
Wed Oct 17 17:52:33 UTC 2007


My Money CCK field module [1] 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.

It shows you a list of existing currencies, relying on the Currency  
API module, which is part of the Currency module [2]. What would be  
required now, is the ability to either manually or based on locale,  
change the formatter completely. Also support for currency symbols  
would be needed, but that's almost trivial.

It's not a Drupal core solution, but it is a solution.

Cheers,

Wim Leers  ~  http://wimleers.com/work


[1] http://drupal.org/project/money
[2] http://drupal.org/project/currency



On Oct 17, 2007, at 19:33 , Ivan Sergio Borgonovo wrote:

> On Wed, 17 Oct 2007 17:47:09 +0200
> Hans Salvisberg <drupal at salvisberg.com> wrote:
>
>> Forget about currency. Currency is completely unrelated to the
>> user's language, and it certainly shouldn't change, just because a
>> user changes their language.
>
> Well you can express amounts in dollars, euros, yuan with different
> formats as you express floats.
>
> Eg. I'm expecting to read
> € 1.234,56
> or
> 1.234,56 EUR
> French people may expect something like:
> 1.234€56
> the - sign can take different places:
> - $ 1.234,56
> $ -1.234,56
> etc...
> an American may expect to read
> € 1,234,56
> in other countries the symbol of the currency may be put after the
> number etc...
> site owner may decide that French people may see currency formatted
> in some way and English people see them formatted differently for the
> *same* currency.
> They may decide to use ISO or just the traditional format of that
> place.
> Providing a sort of PHP date format will just solve the issue and let
> people provide the format they prefer and show the format accordingly
> to the language chosen.
>
> Making it more general could mean adding:
> - sign position
> - decimal/thousands separator
> - major and minor currency symbols
>
> Unless you'd like to add support for non decimal systems as MRO and
> MGA. If this is a blocker for acceptance I could write a more
> generalised function.
> Other stuff could be included in the system described above.
> Even number formats have a wider range (some people group by 2
> digit). I'm not aware of any other more generalised format.
>
> So... no interest at all in having localisation of currency and float
> format?
>
> -- 
> Ivan Sergio Borgonovo
> http://www.webthatworks.it
>



More information about the development mailing list