summaryrefslogtreecommitdiffstats
path: root/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php')
-rw-r--r--core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php
index 3d2fd4a..54d91e7 100644
--- a/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php
+++ b/core/modules/locale/lib/Drupal/locale/LocaleConfigSubscriber.php
@@ -9,6 +9,7 @@ namespace Drupal\locale;
use Drupal\Core\Config\Config;
use Drupal\Core\Config\ConfigEvent;
use Drupal\Core\Config\StorageDispatcher;
+use Drupal\Core\Language\LanguageManager;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -18,6 +19,24 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
* $config is always a DrupalConfig object.
*/
class LocaleConfigSubscriber implements EventSubscriberInterface {
+
+ /**
+ * The language manager for retrieving the interface language.
+ *
+ * @var \Drupal\Core\Language\LanguageManager
+ */
+ protected $languageManager;
+
+ /**
+ * Constructs a LocaleConfigSubscriber object.
+ *
+ * @param \Drupal\Core\Language\LanguageManager $language_manager
+ * The language manager service.
+ */
+ public function __construct(LanguageManager $language_manager) {
+ $this->languageManager = $language_manager;
+ }
+
/**
* Override configuration values with localized data.
*
@@ -26,7 +45,7 @@ class LocaleConfigSubscriber implements EventSubscriberInterface {
*/
public function configLoad(ConfigEvent $event) {
$config = $event->getConfig();
- $language = language(LANGUAGE_TYPE_INTERFACE);
+ $language = $this->languageManager->getLanguage(LANGUAGE_TYPE_INTERFACE);
$locale_name = $this->getLocaleConfigName($config->getName(), $language);
if ($override = $config->getStorage()->read($locale_name)) {
$config->setOverride($override);