I am using XAMPP 8.0.0 on MacOS 11.0.1 and find that setlocale() in PHP is not working. It will return the locale that has been set, as opposed to FALSE, but when I use strftime() the output is always in English, no matter what locale I set. I have checked the contents of the locale files in /usr/share/locale and they are in the correct language, so I am not sure what can be going wrong. Here is my test program:
- Code: Select all
<?php
error_reporting(-1);
ini_set('display_errors', '1');
$disabled = explode(',', ini_get('disable_functions'));
if (in_array('exec', $disabled))
{
$locales = array(
"de",
"de_DE",
"de_DE.utf-8",
"de_DE.UTF-8",
"de_DE.utf8",
"de_DE.UTF8",
"deu",
"german",
"fr_FR"
);
}
else
{
exec('locale -a', $locales);
}
foreach ($locales as $locale)
{
setlocale(LC_TIME, "");
$result = setlocale(LC_TIME, $locale);
var_dump($result);
echo strftime("%A %e %B");
echo "<br>\n";
}