function add_locale()
 {
     $this->setTemplate('edit_locale');
     if (!I18nLocale::canAdd(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('i18n', 'index');
     }
     // if
     $locale = new I18nLocale();
     $locale_data = array_var($_POST, 'locale');
     if (is_array(array_var($_POST, 'locale'))) {
         $locale->setFromAttributes($locale_data);
         try {
             DB::beginWork();
             $locale->save();
             ApplicationLogs::createLog($locale, 0, ApplicationLogs::ACTION_ADD);
             if (plugin_active('tags')) {
                 //$locale->setTagsFromCSV($locale_data['tags']);
             }
             DB::commit();
             flash_success(lang('success add locale'));
             $this->redirectTo('i18n');
         } catch (Exception $e) {
             DB::rollback();
             tpl_assign('error', $e);
             flash_success(lang('error add locale'));
         }
         // try
     }
     tpl_assign('locale', $locale);
     tpl_assign('locale_data', $locale_data);
 }