<?php
class updateAction extends Action
{
    function execute(&$controller, &$request)
    {
        $lang = $request->get('lang');
        $language = new mamboLanguage($lang);
        $language->save();
        $language->load(true);
        $domain = $_POST['domain'];
        $textdomain = mamboCore::get('rootPath')."/language";
        $gettext_admin = new PHPGettextAdmin(true);
        $create_dict = false;

        if (!file_exists("$textdomain/glossary/$lang.$language->charset.po")) {
            $create_dict = true;
        }

        $gettext_admin->add_to_dict($domain, $textdomain, $lang, $language->charset);
        $gettext_admin->message_format($domain, $textdomain, $lang);
        $gettext_admin->compile($lang, $textdomain,  $language->charset);
/*
        $request->set('task', 'index');
        $request->set('act', 'catalogs');
        $request->set('lang', $lang);
        $controller->view('catalogs');
        */
        return  $controller->redirect('index', 'catalogs');
    }
}
?>