Code

Implemented uniqe language definition.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 8 Aug 2007 12:08:48 +0000 (12:08 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 8 Aug 2007 12:08:48 +0000 (12:08 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7002 594d385d-05f5-0310-b6e9-bd551577e9d8

contrib/gosa.conf
include/class_config.inc
include/functions.inc
plugins/admin/ogroups/class_phonequeue.inc
plugins/gofax/faxaccount/class_gofaxAccount.inc
plugins/gofax/faxaccount/generic.tpl
plugins/personal/generic/class_user.inc
plugins/personal/posix/class_posixAccount.inc
setup/class_setupStep_Language.inc

index aa7c0b5940354568a906b358da8dcb64536a3f8a..cc112e0e9b65141a5df7369e5aa214757ada858f 100644 (file)
                                password="{$cv.password}" />
                </location>
 
-               <language name="German" tag="de_DE" />
-               <language name="Russian" tag="ru_RU" />
-               <language name="Spanish" tag="es_ES" />
-               <language name="French" tag="fr_FR" />
-               <language name="Dutch" tag="nl_NL" />
-               <language name="English" tag="en_EN" />
-               <language name="Italian" tag="it_IT" />
-               <language name="Polish" tag="pl_PL" />
-
                <faxformat type="pdf" />
                <faxformat type="ps" />
                <faxformat type="png" />
index a7d3a53b6a0e17e7001f2bde8a2ab0560a667325..c466c97970dce148f5869dea74ccf82e0a8683a9 100644 (file)
@@ -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'){
index aec454e0349d02cd00ebefc85329dd0a16de0179..a82f59d4f1f32707e03816c535a0259210e5fed4 100644 (file)
@@ -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)." &nbsp;(".$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:
 ?>
index 813981e8eea8ecc505873511a7105c8417150d5e..4a24a0b682b99db46b871bb9be15be28fd9d54aa 100644 (file)
@@ -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 */
index 985c13e07aab53ca4190cafc2ce130b33eeed120..ade7e57a7ad186d59b238f21c51128e1c13a6bc4 100644 (file)
@@ -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);
 
index d7587ef2183b45c676aa47b9d884b01e4ded18c9..cb56a6c11690a8cf69caaf99031ee56b4f316792 100644 (file)
@@ -24,7 +24,7 @@
 {render acl=$goFaxLanguageACL}
            <select size="1" name="goFaxLanguage" id="goFaxLanguage" 
                title="{t}Specify the GOfax communication language for fax to mail gateway{/t}">
-           {html_options values=$languages output=$languages selected=$goFaxLanguage}
+                       {html_options options=$languages selected=$goFaxLanguage}
            </select>
 {/render}
 
index 74b19cd1c5fd5a1966cd796db181717a88a15190..ead7b4a6e74437a224acb2a2fc6c0e2062fefb57 100644 (file)
@@ -273,11 +273,7 @@ class user extends plugin
     $sex= array(0 => "&nbsp;", "F" => _("female"), "M" => _("male"));
     $smarty->assign("gender_list", $sex);
 
-    /* Assign prefered langage */
-    $language= array(0 => "&nbsp;", "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 => "&nbsp;") ,get_languages());
     $smarty->assign("preferredLanguage_list", $language);
 
     /* Get random number for pictures */
index 10d575bcb96d231b1ccdc69a8c1a641eb235b4c2..94b8a1b5880ca560f82ddde731c9f5201b7a403c 100644 (file)
@@ -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", "");
index 986c3354251792de7d6930210bf8036a456729b1..e1b5e72ab61c11b2487740b8afb5063b924d967f 100644 (file)
@@ -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);