Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6818b8e

Browse files
Gerry Vandermaesenweaverryan
Gerry Vandermaesen
authored andcommitted
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.
1 parent 34c48f1 commit 6818b8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

book/translation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ need it::
432432
$request = $event->getRequest();
433433

434434
// some logic to determine the $locale
435-
$request->getSession()->set('_locale', $locale);
435+
$request->setLocale($locale);
436436
}
437437

438438
Read :doc:`/cookbook/session/locale_sticky_session` for more on the topic.

0 commit comments

Comments
 (0)