Exemplo n.º 1
0
 function onInstallLanguage($language)
 {
     $configM =& $this->_pluginAPI->getConfigManager();
     $t = $this->_pluginAPI->getI18NManager();
     $cItem = new ConfigItem('/languages/' . $language, STRING);
     $cItem->setValue($language);
     $ret = $configM->addOption($cItem);
     if (isError($ret)) {
         if ($ret->is('CONFIGURATOR_OPTION_EXISTS')) {
             $this->_pluginAPI->addMessage($t->translate('This language already exists'), ERROR);
             $this->_pluginAPI->executePreviousAction();
         } else {
             return $ret;
         }
     } else {
         $this->_pluginAPI->writeConfigFile($configM);
         $this->_pluginAPI->addMessage($t->translate('New language added'), NOTICE);
         $this->_pluginAPI->executePreviousAction();
     }
 }