note 118199 added to function.setlocale
| From: | internationalist | Date: | Sun, 25 Oct 2015 02:09:51 +0000 |
| Subject: | note 118199 added to function.setlocale | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204017@lists.php.net to get a copy of this message | ||
My script runs a loop that changes the locale (multilingual application). I've noticed that on
some random occasion the locale still hasn't changed despite the setlocale() function being
executed a step earlier. I had to add wait time for this condition. Interestingly enough, this was
the case only with the 'nl_NL.UTF8' locale.
<?php
//some code
$this->counter = 0;
// some code
$this->locale = 'nl_NL.UTF8';
setlocale(LC_ALL, $this->locale);
$this->counter++;
if ($this->locale !== setlocale(LC_CTYPE, 0)) { // Locale not changed yet.
if ($this->counter > 10) {
return;
}
sleep(1);
}
// some code
?>
----
Server IP: 72.52.91.14
Probable Submitter: 219.78.44.92
----
Manual Page -- http://php.net/manual/en/function.setlocale.php
Edit -- https://master.php.net/note/edit/118199
Del: integrated -- https://master.php.net/note/delete/118199/integrated
Del: useless -- https://master.php.net/note/delete/118199/useless
Del: bad code -- https://master.php.net/note/delete/118199/bad+code
Del: spam -- https://master.php.net/note/delete/118199/spam
Del: non-english -- https://master.php.net/note/delete/118199/non-english
Del: in docs -- https://master.php.net/note/delete/118199/in+docs
Del: other reasons-- https://master.php.net/note/delete/118199
Reject -- https://master.php.net/note/reject/118199
Search -- https://master.php.net/manage/user-notes.php