Code

Updated language detection; try to use user settings first, the detect browser language
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 13 Aug 2007 07:35:48 +0000 (07:35 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 13 Aug 2007 07:35:48 +0000 (07:35 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7043 594d385d-05f5-0310-b6e9-bd551577e9d8

include/accept-to-gettext.inc

index f04bb4f0b5a243e8c5b85808c776fef83cf4d587..6bf1950e6a1d863becd917306d4ee0cfd7042da7 100644 (file)
@@ -84,9 +84,18 @@ function find_match($curlscore,$curcscore,$curgtlang,$langval,$charval,
 }
 
 
-function al2gt($gettextlangs, $mime) {
+function al2gt($gettextlangs, $mime) 
+{
   error_reporting(0);
 
+  /* Try to use users primary language */
+  $ui= get_userinfo();
+  if ($ui != NULL){
+    if ($ui->language != ""){
+      return ($ui->language.".UTF-8");
+    }
+  }
+
   /* default to "everything is acceptable", as RFC2616 specifies */
   $acceptLang=(($_SERVER["HTTP_ACCEPT_LANGUAGE"] == '') ? '*' :
     $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
@@ -185,4 +194,5 @@ function al2gt($gettextlangs, $mime) {
   return $curgtlang;
 }
 
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>