Skip to content

Commit 03de10f

Browse files
authored
Add note about LocaleListener
LocaleListener uses information provided by Request object. Setting it after LocaleListener read the object results in no effect.
1 parent 35d8ca9 commit 03de10f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

translation/locale.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ it::
2525
// some logic to determine the $locale
2626
$request->setLocale($locale);
2727
}
28+
.. note::
29+
30+
Using a listener like this requires that it is called **before**
31+
LocaleListener attempts to access it. In Symfony Framework it is called
32+
with priority 8 by default. You will need to set your event listener
33+
with a higher one if you want this to work.
2834

2935
Read :doc:`/session/locale_sticky_session` for more information on making
3036
the user's locale "sticky" to their session.

0 commit comments

Comments
 (0)