]> 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 a89bb7805b6bc98c9129620eaaa8ff4016c65efb..7fc8fb699c14f6d05331dd6543d1bf9f7b380d32 100644 (file)
@@ -424,4 +424,23 @@ class ConfigController extends Controller
 
         return $config;
     }
+
+    /**
+     * 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 ($language != null) {
+            $this->get('session')->set('_locale', $language);
+        }
+
+        return $this->redirect($request->headers->get('referer'));
+    }
 }