From ec426fd0c97a7da9922b32bdbe8ee30a1d81777c Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 8 Aug 2007 12:08:48 +0000 Subject: [PATCH] Implemented uniqe language definition. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7002 594d385d-05f5-0310-b6e9-bd551577e9d8 --- contrib/gosa.conf | 9 ----- include/class_config.inc | 11 +---- include/functions.inc | 40 +++++++++++++++++++ plugins/admin/ogroups/class_phonequeue.inc | 2 +- .../gofax/faxaccount/class_gofaxAccount.inc | 2 +- plugins/gofax/faxaccount/generic.tpl | 2 +- plugins/personal/generic/class_user.inc | 6 +-- plugins/personal/posix/class_posixAccount.inc | 4 +- setup/class_setupStep_Language.inc | 7 +--- 9 files changed, 47 insertions(+), 36 deletions(-) diff --git a/contrib/gosa.conf b/contrib/gosa.conf index aa7c0b594..cc112e0e9 100644 --- a/contrib/gosa.conf +++ b/contrib/gosa.conf @@ -513,15 +513,6 @@ password="{$cv.password}" /> - - - - - - - - - diff --git a/include/class_config.inc b/include/class_config.inc index a7d3a53b6..c466c9797 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -38,7 +38,7 @@ class config { /* Configuration data */ var $data= array( 'TABS' => array(), 'LOCATIONS' => array(), 'SERVERS' => array(), - 'MAIN' => array( 'LANGUAGES' => array(), 'FAXFORMATS' => array() ), + 'MAIN' => array( 'FAXFORMATS' => array() ), 'MENU' => array(), 'SERVICE' => array()); var $basedir= ""; @@ -143,15 +143,6 @@ class config { } break; - /* Handle language */ - case 'LANGUAGE': - if ($this->tags[$this->level-2] == 'MAIN'){ - /* Add languages */ - $this->data['MAIN']['LANGUAGES'][$attrs['NAME']]= - $attrs['TAG']; - } - break; - /* Handle faxformat */ case 'FAXFORMAT': if ($this->tags[$this->level-2] == 'MAIN'){ diff --git a/include/functions.inc b/include/functions.inc index aec454e03..a82f59d4f 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -2422,5 +2422,45 @@ function prepare4mailbody($string) + +function get_languages($languages_in_own_language = FALSE,$strip_region_tag = FALSE) +{ + $tmp = array( + "de_DE" => "German", + "fr_FR" => "French", + "it_IT" => "Italian", + "es_ES" => "Spanish", + "en_US" => "English", + "nl_NL" => "Dutch", + "pl_PL" => "Polish", + "sv_SE" => "Swedish", + "zh_CN" => "Chinese", + "ru_RU" => "Russian"); + + $ret = array(); + if($languages_in_own_language){ + $old_lang = setlocale(LC_ALL, 0); + foreach($tmp as $key => $name){ + $lang = $key.".UTF-8"; + setlocale(LC_ALL, $lang); + if($strip_region_tag){ + $ret[preg_replace("/^([^_]*).*$/","\\1",$key)] = _($name)." (".$name.")"; + }else{ + $ret[$key] = _($name)."  (".$name.")"; + } + } + setlocale(LC_ALL, $old_lang); + }else{ + foreach($tmp as $key => $name){ + if($strip_region_tag){ + $ret[preg_replace("/^([^_]*).*/","\\1",$key)] = _($name); + }else{ + $ret[$key] = _($name); + } + } + } + return($ret); +} + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc index 813981e8e..4a24a0b68 100644 --- a/plugins/admin/ogroups/class_phonequeue.inc +++ b/plugins/admin/ogroups/class_phonequeue.inc @@ -267,7 +267,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); /* Set acls */ diff --git a/plugins/gofax/faxaccount/class_gofaxAccount.inc b/plugins/gofax/faxaccount/class_gofaxAccount.inc index 985c13e07..ade7e57a7 100644 --- a/plugins/gofax/faxaccount/class_gofaxAccount.inc +++ b/plugins/gofax/faxaccount/class_gofaxAccount.inc @@ -570,7 +570,7 @@ class gofaxAccount extends plugin /* Show main page */ - $smarty->assign("languages", $this->config->data['MAIN']['LANGUAGES']); + $smarty->assign("languages", get_languages()); $smarty->assign("formats", $this->config->data['MAIN']['FAXFORMATS']); $smarty->assign("printers", $this->printerList); diff --git a/plugins/gofax/faxaccount/generic.tpl b/plugins/gofax/faxaccount/generic.tpl index d7587ef21..cb56a6c11 100644 --- a/plugins/gofax/faxaccount/generic.tpl +++ b/plugins/gofax/faxaccount/generic.tpl @@ -24,7 +24,7 @@ {render acl=$goFaxLanguageACL} {/render} diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 74b19cd1c..ead7b4a6e 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -273,11 +273,7 @@ class user extends plugin $sex= array(0 => " ", "F" => _("female"), "M" => _("male")); $smarty->assign("gender_list", $sex); - /* Assign prefered langage */ - $language= array(0 => " ", "fr_FR" => ("fr_FR"), "en_EN" => ("en_EN"), - "de_DE" => ("de_DE"), "it_IT" => ("it_IT"), - "nl_NL" => ("nl_NL"), "ru_RU" => ("ru_RU"), - "zh_CN" => ("zh_CN")); + $language= array_merge(array(0 => " ") ,get_languages()); $smarty->assign("preferredLanguage_list", $language); /* Get random number for pictures */ diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 10d575bcb..94b8a1b58 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -34,7 +34,6 @@ class posixAccount extends plugin var $shadowInactive= "0"; var $shadowExpire= "0"; var $gosaDefaultPrinter= ""; - var $gosaDefaultLanguage= ""; var $accessTo= array(); var $trustModel= ""; @@ -75,7 +74,7 @@ class posixAccount extends plugin var $attributes = array("homeDirectory", "loginShell", "uidNumber", "gidNumber", "gecos", "shadowMin", "shadowMax", "shadowWarning", "shadowInactive", "shadowLastChange", - "shadowExpire", "gosaDefaultPrinter", "gosaDefaultLanguage", "uid","accessTo","trustModel"); + "shadowExpire", "gosaDefaultPrinter", "uid","accessTo","trustModel"); var $objectclasses= array("posixAccount", "shadowAccount"); @@ -515,7 +514,6 @@ class posixAccount extends plugin } else { $smarty->assign("groups", ""); } - $smarty->assign("languages", $this->config->data['MAIN']['LANGUAGES']); /* Avoid "Undefined index: forceMode" */ $smarty->assign("forceMode", ""); diff --git a/setup/class_setupStep_Language.inc b/setup/class_setupStep_Language.inc index 986c33542..e1b5e72ab 100644 --- a/setup/class_setupStep_Language.inc +++ b/setup/class_setupStep_Language.inc @@ -44,12 +44,7 @@ class Step_Language extends setup_step function execute() { - $this->languages = array("" => _("Automatic"), - "de_DE" => _("German"), - "fr_FR" => _("French"), - "en_EN" => _("English"), - "zh_CN" => _("Chinese"), - "ru_RU" => _("Russian")); + $this->languages = array_merge(array("" => _("Automatic")),get_languages(TRUE)); asort($this->languages); $smarty = get_smarty(); $smarty->assign("languages", $this->languages); -- 2.30.2