From 316d26e8f7ecd2b9c28e7faa7a7b452de5a540fa Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 7 Aug 2007 10:24:26 +0000 Subject: [PATCH] Modified get_languages(), 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 | 15 ++++++++++++--- plugins/admin/ogroups/class_phonequeue.inc | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/functions.inc b/include/functions.inc index ab5f5db9d..9b3e05498 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -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); diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc index 7e712a4a0..569c1268c 100644 --- a/plugins/admin/ogroups/class_phonequeue.inc +++ b/plugins/admin/ogroups/class_phonequeue.inc @@ -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){ -- 2.30.2