Code

Modified get_languages(),
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Aug 2007 10:24:26 +0000 (10:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Aug 2007 10:24:26 +0000 (10:24 +0000)
added parameter to strip region tag from language code "de_DE" -> "de"
Implemented this function into gophonequeue in ogroups

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6983 594d385d-05f5-0310-b6e9-bd551577e9d8

include/functions.inc
plugins/admin/ogroups/class_phonequeue.inc

index ab5f5db9d9559d7c97daae9e5727480e6da31204..9b3e05498995ac19d0b2019ca7c796c5b6e1ebfe 100644 (file)
@@ -2527,7 +2527,7 @@ function mac2company($mac)
 }
 
 
-function get_languages($languages_in_own_language = FALSE)
+function get_languages($languages_in_own_language = FALSE,$strip_region_tag = FALSE)
 {
   $tmp = array(
         "de_DE" => "German",
@@ -2547,12 +2547,21 @@ function get_languages($languages_in_own_language = FALSE)
     foreach($tmp as $key => $name){
       $lang = $key.".UTF-8";
       setlocale(LC_ALL, $lang);
-      $ret[$key] = _($name);
+
+      if($strip_region_tag){
+        $ret[preg_replace("/^([^_]*).*$/","\\1",$key)] = _($name);
+      }else{
+        $ret[$key] = _($name);
+      }
     }
     setlocale(LC_ALL, $old_lang);
   }else{
     foreach($tmp as $key => $name){
-      $ret[$key] = _($name);
+      if($strip_region_tag){
+        $ret[preg_replace("/^([^_]*).*/","\\1",$key)] = _($name);
+      }else{
+        $ret[$key] = _($name);
+      }
     }
   }
   return($ret);
index 7e712a4a0ce0814f602b93fe08d9339437069302..569c1268c2dd8fbc0015ad9a3ad6deb6538021c5 100644 (file)
@@ -259,7 +259,7 @@ class phonequeue extends plugin
 
     /* Assign samrty variables */
     $smarty= get_smarty();
-    $smarty->assign("goFonQueueLanguageOptions",array('de'=>_('German')));
+    $smarty->assign("goFonQueueLanguageOptions",get_languages(FALSE,TRUE));
     $smarty->assign("goFonQueueStrategyOptions", $this->goFonQueueStrategyOptions);
 
     foreach($this->attributes as $key => $val){