2013-05-24 10:59:19 +00:00

24 lines
805 B
PHP

<?php
class Application_Controller_Plugin_Language extends Zend_Controller_Plugin_Abstract
{
public function postDispatch(Zend_Controller_Request_Abstract $request)
{
$registry = Zend_Registry::getInstance();
$translate = $registry->get('Zend_Translate');
$currLocale = $translate->getLocale();
$user = new Scores_Utilisateur();
if ( $user->isLog() ) {
$langtmp = $request->getParam('langtmp', '');
if (!$langtmp)
$langtmp = $user->getLangTmp() ? $user->getLangTmp() : $user->getLang();
$newLocale = new Zend_Locale();
$newLocale->setLocale($langtmp);
$registry->set('Zend_Locale', $newLocale);
$translate->setLocale($langtmp);
$user->setLangTmp($langtmp);
$registry->set('Zend_Translate', $translate);
} else {
$langtmp = 'fr';
}
}
}