]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/ConfigController.php
Added possibility to change locale from login/register pages
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / ConfigController.php
index 242f557f0fad1c4510182db11d43a5094f9db25b..99576fbb93f1fb5277c9ce36077bf55684dd42ba 100644 (file)
@@ -329,6 +329,25 @@ class ConfigController extends Controller
         return $this->redirect($request->headers->get('referer'));
     }
 
+    /**
+     * Change the locale for the current user.
+     *
+     * @param Request $request
+     * @param string  $language
+     *
+     * @Route("/locale/{language}", name="changeLocale")
+     *
+     * @return \Symfony\Component\HttpFoundation\RedirectResponse
+     */
+    public function setLocaleAction(Request $request, $language = null)
+    {
+        if (null !== $language) {
+            $this->get('session')->set('_locale', $language);
+        }
+
+        return $this->redirect($request->headers->get('referer'));
+    }
+
     /**
      * Remove all tags for given tags and a given user and cleanup orphan tags.
      *