Merged in latest changes from STABLE

This commit is contained in:
moodler
2004-06-21 13:07:44 +00:00
parent 19ebd1557a
commit a2fa19d87c
3 changed files with 42 additions and 23 deletions
+24
View File
@@ -2312,6 +2312,30 @@ function moodle_needs_upgrading() {
/// MISCELLANEOUS ////////////////////////////////////////////////////////////////////
function moodle_setlocale($locale='') {
global $SESSION, $USER, $CFG;
if ($locale) {
$CFG->locale = $locale;
} else if (!empty($CFG->courselang) and ($CFG->courselang != $CFG->lang) ) {
$CFG->locale = get_string('locale');
} else if (!empty($SESSION->lang) and ($SESSION->lang != $CFG->lang) ) {
$CFG->locale = get_string('locale');
} else if (!empty($USER->lang) and ($USER->lang != $CFG->lang) ) {
$CFG->locale = get_string('locale');
} else if (empty($CFG->locale)) {
$CFG->locale = get_string('locale');
set_config('locale', $CFG->locale); // cache it to save lookups in future
}
setlocale (LC_TIME, $CFG->locale);
setlocale (LC_COLLATE, $CFG->locale);
if ($CFG->locale != 'tr_TR') { // To workaround a well-known PHP bug with Turkish
setlocale (LC_CTYPE, $CFG->locale);
}
}
function moodle_strtolower ($string, $encoding='') {
/// Converts string to lowercase using most compatible function available
if (function_exists('mb_strtolower')) {