note 63717 added to ref.gettext
| From: | php-general at lists dot php dot net | Date: | Wed, 29 Mar 2006 05:51:53 +0000 |
| Subject: | note 63717 added to ref.gettext | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-106905@lists.php.net to get a copy of this message | ||
> 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.
----
Server IP: 212.124.37.9
Probable Submitter: 84.63.2.175
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/ref.gettext.php
Edit -- http://master.php.net/note/edit/63717
Del: integrated -- http://master.php.net/note/delete/63717/integrated
Del: useless -- http://master.php.net/note/delete/63717/useless
Del: bad code -- http://master.php.net/note/delete/63717/bad+code
Del: spam -- http://master.php.net/note/delete/63717/spam
Del: non-english -- http://master.php.net/note/delete/63717/non-english
Del: in docs -- http://master.php.net/note/delete/63717/in+docs
Del: other reasons-- http://master.php.net/note/delete/63717
Reject -- http://master.php.net/note/reject/63717
Search -- http://master.php.net/manage/user-notes.php