function getScriptFolder() { $path = getScriptPathFull(); if ($path === false) { return false; } $pieces = explode(DIRECTORY_SEPARATOR, $path); if (count($pieces) < 1) { return false; } return $pieces[count($pieces) - 1]; }
} function _me($message, $textdomain = false) { echo _m($message, $textdomain); } if (function_exists('bindtextdomain')) { bindtextdomain("master", $CFG->dirroot . "/locale"); } // Set up the user's locale if (function_exists('bindtextdomain') && function_exists('textdomain') && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { if (class_exists('Locale')) { $locale = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); } else { // Crude fallback if it is missing $pieces = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); $locale = $pieces[0]; } putenv('LC_ALL=' . $locale); setlocale(LC_ALL, $locale); $domain = getScriptFolder(); bindtextdomain($domain, getScriptPathFull() . "/locale"); textdomain($domain); } // TODO: Create this as well related to OUTPUT. See Moodle. // global $PAGE; // Define these globals later. global $OUTPUT, $USER, $CONTEXT, $LINK; $USER = false; $CONTEXT = false; $LINK = false; // No trailer