diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index d2f8f1f65..be772e009 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -7,6 +7,7 @@ Propel::init(__DIR__."/configs/airtime-conf-production.php"); require_once __DIR__."/configs/constants.php"; require_once 'Preference.php'; +require_once 'Locale.php'; require_once "DateHelper.php"; require_once "OsPath.php"; require_once "Database.php"; @@ -34,18 +35,7 @@ $front = Zend_Controller_Front::getInstance(); $front->registerPlugin(new RabbitMqPlugin()); //localization configuration -$codeset = 'UTF-8'; -$lang = Application_Model_Preference::GetLocale().'.'.$codeset; - -putenv("LC_ALL=$lang"); -putenv("LANG=$lang"); -$res = setlocale(LC_MESSAGES, $lang); - -$domain = 'airtime'; -bindtextdomain($domain, '/usr/share/airtime/locale'); -textdomain($domain); -bind_textdomain_codeset($domain, $codeset); - +Application_Model_Locale::configureLocalization(); /* The bootstrap class should only be used to initialize actions that return a view. Actions that return JSON will not use the bootstrap class! */ @@ -107,6 +97,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'/js/cookie/jquery.cookie.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/i18n/jquery.i18n.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/locale/general-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/locale/datatables-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript'); diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index 76be05bf4..fe30097f4 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -5,7 +5,6 @@ class LoginController extends Zend_Controller_Action public function init() { - /* Initialize action controller here */ } public function indexAction() @@ -14,6 +13,7 @@ class LoginController extends Zend_Controller_Action $request = $this->getRequest(); + Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale')); if (Zend_Auth::getInstance()->hasIdentity()) { @@ -43,6 +43,7 @@ class LoginController extends Zend_Controller_Action //get the username and password from the form $username = $form->getValue('username'); $password = $form->getValue('password'); + $locale = $form->getValue('locale'); if (Application_Model_Subjects::getLoginAttempts($username) >= 3 && $form->getElement('captcha') == NULL) { $form->addRecaptcha(); } else { @@ -67,6 +68,9 @@ class LoginController extends Zend_Controller_Action $tempSess = new Zend_Session_Namespace("referrer"); $tempSess->referrer = 'login'; + + //set the user locale in case user changed it in when logging in + Application_Model_Preference::SetUserLocale($auth->getIdentity()->id, $locale); $this->_redirect('Showbuilder'); } else { diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php index cc0dff0bb..e959a5758 100644 --- a/airtime_mvc/application/controllers/UserController.php +++ b/airtime_mvc/application/controllers/UserController.php @@ -162,7 +162,7 @@ class UserController extends Zend_Controller_Action $this->view->successMessage = "