8000 minor #6472 Avoid confusion (gerryvdm) · symfony/symfony-docs@9db055c · GitHub
[go: up one dir, main page]

Skip to content

Commit 9db055c

Browse files
committed
minor #6472 Avoid confusion (gerryvdm)
This PR was submitted for the 3.0 branch but it was merged into the 2.3 branch instead (closes #6472). Discussion ---------- 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 8000 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. Commits ------- 6818b8e Avoid confusion
2 parents 34c48f1 + 6818b8e commit 9db055c

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)
0