From: hickert Date: Fri, 31 Aug 2007 11:12:39 +0000 (+0000) Subject: Updated language detection for main.inc X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=270df98dac38afb3b1fdb57478c803286866a00e;p=gosa.git Updated language detection for main.inc get_browser_language will now return langauge with following priority. User-language Global-Language Browser-Language git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7180 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/html/main.php b/html/main.php index 5a7261cb9..2a25aa99b 100644 --- a/html/main.php +++ b/html/main.php @@ -125,19 +125,15 @@ 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 */ +$lang= get_browser_language(); +if($_SESSION['Last_init_lang'] != $lang){ + $reload_navigation = true; } +/* Language setup */ +$_SESSION['Last_init_lang'] = $lang; + /* Preset current main base */ if(!isset($_SESSION['CurrentMainBase'])){ $_SESSION['CurrentMainBase']= get_base_from_people($ui->dn); diff --git a/include/functions.inc b/include/functions.inc index 014b0c031..7c559dbbe 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -152,6 +152,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 != ""){ @@ -159,6 +160,15 @@ function get_browser_language() } } + /* Check for global language settings in gosa.conf */ + if(isset($config->data['MAIN']['LANG']) && !empty($config->data['MAIN']['LANG'])) { + $lang = $config->data['MAIN']['LANG']; + if(!preg_match("/utf/i",$lang)){ + $lang .= ".UTF-8"; + } + return($lang); + } + /* Load supported languages */ $gosa_languages= get_languages();