/** * Set a current language. * The language specified may be an empty string, which will assume that the system * should try to detect an appropriate language. If no default can be found for * some reason, en_US will be assumed. * * When a language is found, the system will automatically set the locale for the request. * * Note: CMSMS 1.11 and above will not support multiple languages per request. * therefore, it should be assumed that this function can only be called once per request. * * @internal * @see set_locale * @param string The desired language. * @return boolean */ public static function set_language($lang = null) { $curlang = ''; if (self::$_cur_lang != '') { // lang has been previously set. $curlang = self::$_cur_lang; } if ($lang != '') { $lang = self::find_nls_match($lang); } if ($lang == '') { $lang = self::get_default_language(); } if ($curlang == $lang) { return TRUE; } // nothing to do. self::_load_nls(); if (isset(self::$_nls[$lang])) { // lang is okay... now we can set it. self::$_cur_lang = $lang; // and set the locale along with this language. self::set_locale(); return TRUE; } return FALSE; }