Code

Updated language detection for main.inc
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 31 Aug 2007 11:12:39 +0000 (11:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 31 Aug 2007 11:12:39 +0000 (11:12 +0000)
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

html/main.php
include/functions.inc

index 5a7261cb9e7ee7516d8b95e3dcffdacc649b0982..2a25aa99be64dcdae1296069e9972bfd6e6f1321 100644 (file)
@@ -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);
index 014b0c031c6b1e1f41fe62b85c577b62c08076ad..7c559dbbea42e3c88fe606d812f1cfff5d7a80d6 100644 (file)
@@ -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();