note 63717 deleted from ref.gettext by nlopess
| From: | nlopess@php.net | Date: | Wed, 29 Mar 2006 09:33:17 +0000 |
| Subject: | note 63717 deleted from ref.gettext by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106929@lists.php.net to get a copy of this message | ||
Note Submitter:
----
> stefan+usenet at froehlich dot priv dot at wrote at 5-May-2004 01:30:
> Reading the line
>
> <? php setlocale(LC_ALL, 'de_DE'); ?>
>
> here over and over again, I have to warn using it, as there are severe caveats.
> For certain locales, LC_NUMERIC swaps period and comma, which may e.g. lead to
> decimals silently stripped of numbers, when inserting rows into an SQL database.
>So DON'T do this, but use
>
> <? php setlocale(LC_MESSAGES, 'de_DE'); ?>
>
> instead, which does exactly what you want, without any nasty side effecs.
For all Windows-Users:
Be warned the LC_MESSAGES seems to be NOT set on Windows with PHP 5.1.2, so if you develope
applications for a Linux-System and want to make it multi-language using gettext, you will get
problems using LC_MESSAGES on your Windows-Developement-Box.
You can try to solve this problem by putting a
<?php if (!defined('LC_MESSAGES')) define('LC_MESSAGES', 6); ?>
to your script to get no warning if you pass LC_MESSAGES to the setlocale()-function.