@@ -73,16 +73,18 @@ via some "Change Locale" route & controller), or create a route with a the :ref:
7373
7474 .. code-block :: yaml
7575
76+ # config/services.yaml
7677 services :
7778 # ...
7879
7980 App\EventSubscriber\LocaleSubscriber :
8081 arguments : ['%kernel.default_locale%']
81- # redundant if you're using autoconfigure
82- tags : [kernel.event_subscriber]
82+ # uncomment the next line if you are not using autoconfigure
83+ # tags: [kernel.event_subscriber]
8384
8485 .. code-block :: xml
8586
87+ <!-- config/services.xml -->
8688 <?xml version =" 1.0" encoding =" UTF-8" ?>
8789 <container xmlns =" http://symfony.com/schema/dic/services"
8890 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
@@ -93,18 +95,21 @@ via some "Change Locale" route & controller), or create a route with a the :ref:
9395 <service id =" App\EventSubscriber\LocaleSubscriber" >
9496 <argument >%kernel.default_locale%</argument >
9597
96- <tag name =" kernel.event_subscriber" />
98+ <!-- uncomment the next line if you are not using autoconfigure -->
99+ <!-- <tag name="kernel.event_subscriber" /> -->
97100 </service >
98101 </services >
99102 </container >
100103
101104 .. code-block :: php
102105
106+ // config/services.php
103107 use App\EventSubscriber\LocaleSubscriber;
104108
105109 $container->register(LocaleSubscriber::class)
106110 ->addArgument('%kernel.default_locale%')
107- ->addTag('kernel.event_subscriber');
111+ // uncomment the next line if you are not using autoconfigure
112+ // ->addTag('kernel.event_subscriber');
108113
109114 That's it! Now celebrate by changing the user's locale and seeing that it's
110115sticky throughout the request.
@@ -115,7 +120,7 @@ method::
115120 // from a controller...
116121 use Symfony\Component\HttpFoundation\Request;
117122
118- public function indexAction (Request $request)
123+ public function index (Request $request)
119124 {
120125 $locale = $request->getLocale();
121126 }
@@ -160,9 +165,6 @@ event:
160165 $this->session = $session;
161166 }
162167
163- /**
164- * @param InteractiveLoginEvent $event
165- */
166168 public function onInteractiveLogin(InteractiveLoginEvent $event)
167169 {
168170 $user = $event->getAuthenticationToken()->getUser();
0 commit comments