mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-44843 try to hack around strict locale names in OSX
This commit is contained in:
parent
ad32dda90c
commit
25ab60ba8e
1 changed files with 12 additions and 1 deletions
|
@ -7665,7 +7665,18 @@ function moodle_setlocale($locale='') {
|
||||||
$messages= setlocale (LC_MESSAGES, 0);
|
$messages= setlocale (LC_MESSAGES, 0);
|
||||||
}
|
}
|
||||||
// Set locale to all.
|
// Set locale to all.
|
||||||
setlocale (LC_ALL, $currentlocale);
|
$result = setlocale (LC_ALL, $currentlocale);
|
||||||
|
// If setting of locale fails try the other utf8 or utf-8 variant,
|
||||||
|
// some operating systems support both (Debian), others just one (OSX).
|
||||||
|
if ($result === false) {
|
||||||
|
if (stripos($currentlocale, '.UTF-8') !== false) {
|
||||||
|
$newlocale = str_ireplace('.UTF-8', '.UTF8', $currentlocale);
|
||||||
|
setlocale (LC_ALL, $newlocale);
|
||||||
|
} else if (stripos($currentlocale, '.UTF8') !== false) {
|
||||||
|
$newlocale = str_ireplace('.UTF8', '.UTF-8', $currentlocale);
|
||||||
|
setlocale (LC_ALL, $newlocale);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Set old values.
|
// Set old values.
|
||||||
setlocale (LC_MONETARY, $monetary);
|
setlocale (LC_MONETARY, $monetary);
|
||||||
setlocale (LC_NUMERIC, $numeric);
|
setlocale (LC_NUMERIC, $numeric);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue