File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -429,13 +429,13 @@ via the ``request`` object::
429
429
$request->setLocale('en_US');
430
430
}
431
431
432
-
433
432
.. note ::
434
433
435
- Setting the locale using ``$request->setLocale() `` won't affect rendering
436
- in the same action as the translator reads the request locale during the
437
- kernel.request event, so changing it here would be too late. To manually
438
- change translation locale in the controller use ``$this->get('translator')->setLocale() ``.
434
+ Setting the locale using the ``$request->setLocale() `` method won't affect
435
+ rendering in the same action. The translator locale is set during the
436
+ kernel.request event. Either set the locale before the listener is called
437
+ (e.g. in a custom listener) or use the ``setLocale() `` method of the
438
+ ``translator `` service.
439
439
440
440
.. tip ::
441
441
You can’t perform that action at this time.
0 commit comments