]> dev.renevier.net Git - syj.git/blobdiff - application/controllers/plugins/SyjLocale.php
update copyright headers
[syj.git] / application / controllers / plugins / SyjLocale.php
index 19af8ec77e5409e7985f9dca0e260e95699f99ac..8103ac78c0204050a46beb29023781111cf05306 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-/*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+/*  This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
     and is published under the AGPL license. */
 
 class Syj_Controllers_Plugins_SyjLocale extends Zend_Controller_Plugin_Abstract
@@ -7,11 +7,14 @@ class Syj_Controllers_Plugins_SyjLocale extends Zend_Controller_Plugin_Abstract
 
     public function preDispatch(Zend_Controller_Request_Abstract $request) {
         $lang = $request->getQuery('lang');
-        if (is_null($lang)) {
-            return;
+
+        if ($lang) {
+            setcookie("syj_lang", $lang, 0, "", "", false, true);
+        } else {
+            $lang = $request->getCookie('syj_lang');
         }
 
-        if (!Zend_Registry::isRegistered('Zend_Translate')) {
+        if (!$lang) {
             return;
         }