Skip to content

Commit 8bfd254

Browse files
committed
minor #8411 Add note about LocaleListener (Steveb-p, javiereguiluz)
This PR was merged into the 3.3 branch. Discussion ---------- Add note about LocaleListener LocaleListener uses information provided by Request object. Setting your own Listener, which is supposed to change request object locale, without priority results in LocaleListener already having it's locale set up and not reacting at all. This change adds this warning to documentation. Commits ------- 531909d Reword 1492f3e Remove information about default priority 52681f4 Fix missing blank line 03de10f Add note about LocaleListener
2 parents df427a7 + 531909d commit 8bfd254

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

translation/locale.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ it::
2626
$request->setLocale($locale);
2727
}
2828

29+
.. note::
30+
31+
The custom listener must be called **before** ``LocaleListener``, which
32+
initializes the locale based on the current request. To do so, set your
33+
listener priority to a higher value than ``LocaleListener`` priority (which
34+
you can obtain running the ``debug:event kernel.request`` command).
35+
2936
Read :doc:`/session/locale_sticky_session` for more information on making
3037
the user's locale "sticky" to their session.
3138

0 commit comments

Comments
 (0)