8000 Rebase of #4989 by weaverryan · Pull Request #5099 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content
8000

Rebase of #4989 #5099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Review note about setting the translator locale in a controller.
  • Loading branch information
solazs authored and weaverryan committed Mar 20, 2015
commit 1bfc46dc60db3217579d496c7eab3401be16bf14
10 changes: 5 additions & 5 deletions book/translation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,13 @@ via the ``request`` object::
$request->setLocale('en_US');
}


.. note::

Setting the locale using ``$request->setLocale()`` won't affect rendering
in the same action as the translator reads the request locale during the
kernel.request event, so changing it here would be too late. To manually
change translation locale in the controller use ``$this->get('translator')->setLocale()``.
Setting the locale using the ``$request->setLocale()`` method won't affect
rendering in the same action. The translator locale is set during the
kernel.request event. Either set the locale before the listener is called
(e.g. in a custom listener) or use the ``setLocale()`` method of the
``translator`` service.

.. tip::

Expand Down
0