From: hickert Date: Fri, 31 Aug 2007 12:08:52 +0000 (+0000) Subject: Updated language handling. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1ed2abfd71a95286e00c3820c4982fb423dd816d;p=gosa.git Updated language handling. Language string return by get_browser_language() updated. Return user defined language first, then global and at least the browsers supported language. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7183 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/html/index.php b/html/index.php index fcd613084..ab9ed3f5c 100644 --- a/html/index.php +++ b/html/index.php @@ -146,12 +146,7 @@ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){ /* Check for old files in compile directory */ clean_smarty_compile_dir($smarty->compile_dir); -/* Language setup */ -if ($config->data['MAIN']['LANG'] == ""){ - $lang= get_browser_language(); -} else { - $lang= $config->data['MAIN']['LANG']; -} +$lang= get_browser_language(); putenv("LANGUAGE="); putenv("LANG=$lang"); setlocale(LC_ALL, $lang); diff --git a/html/main.php b/html/main.php index 0093a9653..3eb9acca9 100644 --- a/html/main.php +++ b/html/main.php @@ -122,18 +122,12 @@ if((!isset($_SESSION['Last_init_lang']))){ $_SESSION['Last_init_lang'] = get_browser_language(); } -/* Language setup */ -if ($config->data['MAIN']['LANG'] == ""){ - - /* If last language != current force navi reload */ - if($_SESSION['Last_init_lang'] != get_browser_language()){ - $reload_navigation = true; - } - $lang= get_browser_language(); - $_SESSION['Last_init_lang'] = $lang; -} else { - $lang= $config->data['MAIN']['LANG']; +/* If last language != current force navi reload */ +if($_SESSION['Last_init_lang'] != get_browser_language()){ + $reload_navigation = true; } +$lang= get_browser_language(); +$_SESSION['Last_init_lang'] = $lang; putenv("LANGUAGE="); putenv("LANG=$lang"); diff --git a/include/functions.inc b/include/functions.inc index 5358c6f09..cae474cb8 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -150,6 +150,7 @@ function DEBUG($level, $line, $function, $file, $data, $info="") function get_browser_language() { /* Try to use users primary language */ + global $config; $ui= get_userinfo(); if ($ui != NULL){ if ($ui->language != ""){ @@ -157,6 +158,13 @@ function get_browser_language() } } + /* Try to use users primary language */ + if ($ui != NULL){ + if ($ui->language != ""){ + return ($ui->language.".UTF-8"); + } + } + /* Load supported languages */ $gosa_languages= get_languages(); diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index cd87f29ca..edf9a4701 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -883,6 +883,12 @@ class user extends plugin /* Finally write data with selected 'mode' */ $this->cleanup(); + + if(isset($this->attrs['preferredLanguage'])){ + $_SESSION['ui']->language = $this->preferredLanguage; + $_SESSION['Last_init_lang'] = "update"; + } + $ldap->cd ($this->dn); $ldap->$mode ($this->attrs); if (show_ldap_error($ldap->get_error(), _("Saving generic user account failed"))){