Example #1
0
 /**
  * Get the local. Logic depends on whether the given controller is marked
  * as 'urlLocale' or not.
  *
  * @param Context $ctx
  * @param Controller $controller
  * @param String $lang the language from the URL, or null if it's not there.
  * @return String locale (language)
  */
 private function getLocale($ctx, $controller, $lang)
 {
     // We only care here about controllers which are marked as 'urlLocale'
     if (!$controller->isLocaleSupported()) {
         return $ctx->getUser()->getLocale();
     }
     if (!$lang) {
         $lang = $ctx->getUser()->getLocale();
     }
     // Update anonymous user's locale, if it's different than the given lang
     if ($ctx->getUser()->isAnonymous() && $ctx->getUser()->getLocale() != $lang) {
         $ctx->getUser()->setLocale($lang);
         // TODO: does this code have to be here??
         Zend_Session::setOptions(array('cookie_httponly' => 'on'));
         Zend_Session::RememberMe(1209600);
         // 14 days
     }
     return $lang;
 }