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

Ivan Sergio Borgonovo mail at webthatworks.it
Mon Oct 22 08:21:16 UTC 2007

On Sun, 21 Oct 2007 15:53:20 -0500
Larry Garfield <larry at garfieldtech.com> wrote:

> > > for DateTime in general, I recommend this page:
> > >
> > > http://laughingmeme.org/2007/02/27/looking-at-php5s-datetime-and-datetime
> > >zone/

Finally I read it fully. It looks Zend is going Microsoft if you read
one of the comments ;)
I've vague memories of Windows timezone setup and it doesn't let you
guess there is such a mess behind.

Anyway I can't find a place in drupal for such a beast. (OK, I may be
wrong... but then tell me...).
There is the time of the server and there is the time of the user.
You don't know where the user is and you've to ask which timezone he
prefer. Guessing where the user is and which timezone he is in, is a
risk that doesn't fit to much in core.
Once you ask... well you don't need the Olson bag with you.
Computations with dates should be a language task not drupal task.

I've the same feeling with currencies.
To avoid rounding problems I'd think as currencies as int + decimal
places. As we can see from man 5 locale there are more options for
formatting currencies and numbers and it doesn't seem there is any
reasonable working facility in php to exploit.

> Well since I only started talking about it 2 days ago, not that I
> know of. :-) Really, I was just throwing out an alternative
> approach to take that would offer more long-term flexibility for
> currency handling.

Unless you take in Zend stuff I see no way to exploit all the info
you generally have in locale and locale settings are shared across
threads in the same process.

BTW Debian etch installed in Italian:

ivan at wtw:~$ export LANG='it_IT.utf8';export LC_ALL='it_IT.utf8'; php
-r 'setlocale(LC_ALL,'it_IT.utf8');$num=1.5;echo $num;echo("\n");'


ivan at wtw:~$ locale -a

that 1.5 should be 1,5

Ivan Sergio Borgonovo

More information about the development mailing list