original_string: public function setLocaleForUnauthenticatedUser(GetResponseEvent $event)
      {
          if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
              return;
          }
          $request = $event->getRequest();
          if ('unset' == $request->getLocale()) {
              if ($locale = $request->getSession()->get('_locale')) {
                  $request->setLocale($locale);
              } else {
                  $request->setLocale($request->getPreferredLanguage());
              }
          }
      }
code: public function setLocaleForUnauthenticatedUser(GetResponseEvent $event)
      {
          if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
              return;
          }
          $request = $event->getRequest();
          if ('unset' == $request->getLocale()) {
              if ($locale = $request->getSession()->get('_locale')) {
                  $request->setLocale($locale);
              } else {
                  $request->setLocale($request->getPreferredLanguage());
              }
          }
      }
code_tokens: public function setLocaleForUnauthenticatedUser ( GetResponseEvent $ event ) { if ( HttpKernelInterface :: MASTER_REQUEST !== $ event -> getRequestType ( ) ) { return ; } $ request = $ event -> getRequest ( ) ; if ( 'unset' == $ request -> getLocale ( ) ) { if ( $ locale = $ request -> getSession ( ) -> get ( '_locale' ) ) { $ request -> setLocale ( $ locale ) ; } else { $ request -> setLocale ( $ request -> getPreferredLanguage ( ) ) ; } } }
docstring: kernel.request event. If a guest user doesn't have an opened session, locale is equal to
  "undefined" as configured by default in parameters.ini. If so, set as a locale the user's
  preferred language.
  
  @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
docstring_tokens: kernel . request event . If a guest user doesn t have an opened session locale is equal to undefined as configured by default in parameters . ini . If so set as a locale the user s preferred language .