diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 700e788..aa1cd08 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -899,7 +899,6 @@ protected function initializeContainer() { // The request stack is preserved across container rebuilds. Reinject the // new session into the master request if one was present before. - $request = NULL; if (($request_stack = $this->container->get('request_stack', ContainerInterface::NULL_ON_INVALID_REFERENCE))) { if ($request = $request_stack->getMasterRequest()) { if ($request->hasSession()) { @@ -913,9 +912,8 @@ protected function initializeContainer() { } \Drupal::setContainer($this->container); - if ($request) { - $this->container->get('event_dispatcher')->dispatch(self::CONTAINER_INITIALIZE_FINISHED); - } + $this->container->get('event_dispatcher')->dispatch(self::CONTAINER_INITIALIZE_FINISHED); + // If needs dumping flag was set, dump the container. if ($this->containerNeedsDumping && !$this->cacheDrupalContainer($container_definition)) { $this->container->get('logger.factory')->get('DrupalKernel')->error('Container cannot be saved to cache.'); diff --git a/core/lib/Drupal/Core/DrupalKernelInterface.php b/core/lib/Drupal/Core/DrupalKernelInterface.php index 5d26010..df55272 100644 --- a/core/lib/Drupal/Core/DrupalKernelInterface.php +++ b/core/lib/Drupal/Core/DrupalKernelInterface.php @@ -15,8 +15,7 @@ interface DrupalKernelInterface extends HttpKernelInterface, ContainerAwareInterface { /** - * Thde CONTAINER_INITIALIZE_FINISHED event occurs when the service container - * finished initializing. + * Name of the event fired when the service container finished initializing. * * This event allows you to initialize overrides such as language to the * services. diff --git a/core/modules/language/src/EventSubscriber/LanguageRequestSubscriber.php b/core/modules/language/src/EventSubscriber/LanguageRequestSubscriber.php index c8e0eaf..9e34b6d 100644 --- a/core/modules/language/src/EventSubscriber/LanguageRequestSubscriber.php +++ b/core/modules/language/src/EventSubscriber/LanguageRequestSubscriber.php @@ -65,7 +65,7 @@ public function __construct(ConfigurableLanguageManagerInterface $language_manag } /** - * Sets the request on the language manager at the beginning of the request. + * Initializes the language manager at the beginning of the request. * * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event * The Event to process. @@ -73,30 +73,29 @@ public function __construct(ConfigurableLanguageManagerInterface $language_manag public function onKernelRequestLanguage(GetResponseEvent $event) { if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) { $this->setLanguageOverrides(); + // After the language manager has initialized, set the default langcode + // for the string translations. + $langcode = $this->languageManager->getCurrentLanguage()->getId(); + $this->translation->setDefaultLangcode($langcode); } } /** - * Sets the request on the language manager whenever the service container is rebuilt. + * Initializes config overrides whenever the service container is rebuilt. */ public function onContainerInitializeFinished() { $this->setLanguageOverrides(); } /** - * Sets the request on the language manager. + * Sets the language for config overrides on the language manager. */ private function setLanguageOverrides() { $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); } /**