/**
  * Constructs a PathProcessorLanguage object.
  *
  * @param \Drupal\Core\Config\ConfigFactoryInterface $config
  *   A config factory object for retrieving configuration settings.
  * @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager
  *   The configurable language manager.
  * @param \Drupal\language\LanguageNegotiatorInterface
  *   The language negotiator.
  * @param \Drupal\Core\Session\AccountInterface $current_user
  *   The current active user.
  */
 public function __construct(ConfigFactoryInterface $config, ConfigurableLanguageManagerInterface $language_manager, LanguageNegotiatorInterface $negotiator, AccountInterface $current_user)
 {
     $this->config = $config;
     $this->languageManager = $language_manager;
     $this->negotiator = $negotiator;
     $this->negotiator->setCurrentUser($current_user);
 }
 /**
  * Constructs a PathProcessorLanguage object.
  *
  * @param \Drupal\Core\Config\ConfigFactoryInterface $config
  *   A config factory object for retrieving configuration settings.
  * @param \Drupal\Core\Site\Settings $settings
  *   The settings instance.
  * @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager
  *   The configurable language manager.
  * @param \Drupal\language\LanguageNegotiatorInterface
  *   The language negotiator.
  * @param \Drupal\Core\Session\AccountInterface $current_user
  *   The current active user.
  */
 public function __construct(ConfigFactoryInterface $config, Settings $settings, ConfigurableLanguageManagerInterface $language_manager, LanguageNegotiatorInterface $negotiator, AccountInterface $current_user)
 {
     $this->config = $config;
     $this->mixedModeSessions = $settings->get('mixed_mode_sessions', FALSE);
     $this->languageManager = $language_manager;
     $this->negotiator = $negotiator;
     $this->negotiator->setCurrentUser($current_user);
 }
 /**
  * Sets the request on the language manager.
  *
  * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
  *   The Event to process.
  */
 public function onKernelRequestLanguage(GetResponseEvent $event)
 {
     if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
         $request = $event->getRequest();
         $this->negotiator->setCurrentUser($this->currentUser);
         $this->negotiator->reset();
         if ($this->languageManager instanceof ConfigurableLanguageManagerInterface) {
             $this->languageManager->setNegotiator($this->negotiator);
             $this->languageManager->setConfigOverrideLanguage($this->languageManager->getCurrentLanguage());
         }
         // After the language manager has initialized, set the default langcode
         // for the string translations.
         $langcode = $this->languageManager->getCurrentLanguage()->getId();
         $this->translation->setDefaultLangcode($langcode);
     }
 }