From 98e69c876ddc19fb3ec622ba9e411ec741da61ef Mon Sep 17 00:00:00 2001 From: Gerry Vandermaesen Date: Thu, 14 Apr 2016 09:16:32 +0200 Subject: [PATCH] Avoid confusion To me it was a bit confusing why the locale was set on the session and not the request. Further more, reading the linked article shows extra code is needed to make this work at all. Since the linked article explains in more detail how to make the locale sticky, I suggest just setting it on the request in this code sample. --- book/translation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/translation.rst b/book/translation.rst index e21f5b7084d..c653ad5b12e 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -482,7 +482,7 @@ need it:: $request = $event->getRequest(); // some logic to determine the $locale - $request->getSession()->set('_locale', $locale); + $request->setLocale($locale); } Read :doc:`/cookbook/session/locale_sticky_session` for more on the topic.