コード例 #1
0
 /**
  * Refresh all installed languages
  */
 static function refreshAll()
 {
     global $ilPluginAdmin;
     $languages = ilObject::_getObjectsByType("lng");
     foreach ($languages as $lang) {
         $langObj = new ilObjLanguage($lang["obj_id"], false);
         if ($langObj->isInstalled() == true) {
             if ($langObj->check()) {
                 $langObj->flush('keep_local');
                 $langObj->insert();
                 $langObj->setTitle($langObj->getKey());
                 $langObj->setDescription($langObj->getStatus());
                 $langObj->update();
                 $langObj->optimizeData();
                 if ($langObj->isLocal() == true) {
                     if ($langObj->check('local')) {
                         $langObj->insert('local');
                         $langObj->setTitle($langObj->getKey());
                         $langObj->setDescription($langObj->getStatus());
                         $langObj->update();
                         $langObj->optimizeData();
                     }
                 }
             }
         }
         unset($langObj);
     }
     // refresh languages of activated plugins
     include_once "./Services/Component/classes/class.ilPluginSlot.php";
     $slots = ilPluginSlot::getAllSlots();
     foreach ($slots as $slot) {
         $act_plugins = $ilPluginAdmin->getActivePluginsForSlot($slot["component_type"], $slot["component_name"], $slot["slot_id"]);
         foreach ($act_plugins as $plugin) {
             include_once "./Services/Component/classes/class.ilPlugin.php";
             $pl = ilPlugin::getPluginObject($slot["component_type"], $slot["component_name"], $slot["slot_id"], $plugin);
             if (is_object($pl)) {
                 $pl->updateLanguages();
             }
         }
     }
 }
コード例 #2
0
 /**
  * set the system language
  */
 function setSystemLanguageObject()
 {
     $this->lng->loadLanguageModule("meta");
     if (!isset($_POST["id"])) {
         $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
     }
     if (count($_POST["id"]) != 1) {
         $this->ilias->raiseError($this->lng->txt("choose_only_one_language") . "<br/>" . $this->lng->txt("action_aborted"), $this->ilias->error_obj->MESSAGE);
     }
     $obj_id = $_POST["id"][0];
     $newSysLangObj = new ilObjLanguage($obj_id);
     if ($newSysLangObj->isSystemLanguage()) {
         $this->ilias->raiseError($this->lng->txt("meta_l_" . $newSysLangObj->getKey()) . " is already the system language!<br>Action aborted!", $this->ilias->error_obj->MESSAGE);
     }
     if ($newSysLangObj->isInstalled() == false) {
         $this->ilias->raiseError($this->lng->txt("meta_l_" . $newSysLangObj->getKey()) . " is not installed. Please install that language first.<br>Action aborted!", $this->ilias->error_obj->MESSAGE);
     }
     $this->ilias->setSetting("language", $newSysLangObj->getKey());
     // update ini-file
     $this->ilias->ini->setVariable("language", "default", $newSysLangObj->getKey());
     $this->ilias->ini->write();
     $this->data = $this->lng->txt("system_language") . " " . $this->lng->txt("changed_to") . " " . $this->lng->txt("meta_l_" . $newSysLangObj->getKey()) . ".";
     $this->out();
 }