2013-05-15 10:18:51 +00:00

31 lines
902 B
PHP

<?php
class Application_Controller_Plugin_Language extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$registry = Zend_Registry::getInstance();
$translate = $registry->get('Zend_Translate');
$currLocale = $translate->getLocale();
$user = new Scores_Utilisateur();
if ( $user->isLog() ) {
switch ($user->getLang()) {
case "en":
$langLocale = 'en';
break;
case "fr":
default:
$langLocale = 'fr';
}
} else {
$langLocale = 'fr';
}
$newLocale = new Zend_Locale();
$newLocale->setLocale($langLocale);
$registry->set('Zend_Locale', $newLocale);
$translate->setLocale($langLocale);
$registry->set('Zend_Translate', $translate);
}
}