+ /*
+ Set lamguage for next report
+ */
+ function SetLang($code=null)
+ {
+ global $installed_languages, $dflt_lang, $path_to_root;
+
+ if (!$code)
+ $code = $dflt_lang;
+
+ $lang = array_search_value($code, $installed_languages, 'code');
+ $_SESSION['get_text']->set_language($lang['code'], strtoupper($lang['encoding']));
+ $_SESSION['get_text']->add_domain($lang['code'], $path_to_root . "/lang");
+
+ // re-read translated sys names.
+ include($path_to_root.'/includes/sysnames.inc');
+
+ $l = array('a_meta_charset' => strtoupper($lang['encoding']),
+ 'a_meta_dir' => @$lang['rtl'] ? 'rtl' : 'ltr',
+ 'a_meta_language' => $code, 'w_page' => 'page');
+
+ if (!isset($l['a_meta_charset']))
+ $l = array('a_meta_charset' => 'ISO-8859-1', 'a_meta_dir' => 'ltr', 'a_meta_language' => 'en_GB', 'w_page' => 'page');
+ $enc = $l['a_meta_charset'];
+ $uni = ($enc == 'UTF-8' || $enc == 'GB2312' ? true : false);
+ if ($uni)
+ ini_set("memory_limit", "48M");
+
+ $this->isunicode = $uni;
+ $this->setLanguageArray($l);
+ if ($uni)
+ {
+ global $unicode, $unicode_mirror, $unicode_arlet, $laa_array, $diacritics;
+ include_once(dirname(__FILE__)."/unicode_data2.php");
+ }
+ $this->encoding = strtoupper($lang['encoding']);