diff --git a/core/modules/language/src/Element/LanguageConfiguration.php b/core/modules/language/src/Element/LanguageConfiguration.php index aa6f94b..10fa8da 100644 --- a/core/modules/language/src/Element/LanguageConfiguration.php +++ b/core/modules/language/src/Element/LanguageConfiguration.php @@ -97,7 +97,7 @@ public static function processLanguageConfiguration(&$element, FormStateInterfac protected static function getDefaultOptions() { $language_options = array( LanguageInterface::LANGCODE_SITE_DEFAULT => t("Site's default language (!language)", array('!language' => static::languageManager()->getDefaultLanguage()->getName())), - 'current_interface' => t('Current interface language'), + 'current_interface' => t('!type language selected for page', array('!type' => 'User interface text')), 'authors_default' => t("Author's preferred language"), ); diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php index 4d252e2..c39452f 100644 --- a/core/modules/views/src/Plugin/views/PluginBase.php +++ b/core/modules/views/src/Plugin/views/PluginBase.php @@ -515,6 +515,7 @@ public function getProvider() { */ protected function listLanguages($flags = LanguageInterface::STATE_ALL) { $manager = \Drupal::languageManager(); + $languages = $manager->getLanguages($flags); $list = array(); // The entity languages should come first, if requested. @@ -523,16 +524,14 @@ protected function listLanguages($flags = LanguageInterface::STATE_ALL) { $list['***LANGUAGE_entity_default***'] = $this->t('Original language of content in view row'); } - // The Language Manager class takes care of the STATE_SITE_DEFAULT case. - // It comes in with ID set to LanguageInterface::LANGCODE_SITE_DEFAULT. + // STATE_SITE_DEFAULT comes in with ID set to LanguageInterface::LANGCODE_SITE_DEFAULT. // Since this is not a real language, surround it by '***LANGUAGE_...***', // like the negotiated languages below. - $languages = $manager->getLanguages($flags); - foreach ($languages as $id => $language) { - if ($id == LanguageInterface::LANGCODE_SITE_DEFAULT) { - $id = PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT; - } - $list[$id] = $this->t($language->getName()); + if ($flags & LanguageInterface::STATE_SITE_DEFAULT) { + $list[PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT] = $this->t($languages[LanguageInterface::LANGCODE_SITE_DEFAULT]->getName()); + // Remove site's default from the languages' array so it's not added + // with the real languages below. + unset($languages[LanguageInterface::LANGCODE_SITE_DEFAULT]); } // Add in negotiated languages, if requested. @@ -549,6 +548,11 @@ protected function listLanguages($flags = LanguageInterface::STATE_ALL) { } } + // Add real languages. + foreach ($languages as $id => $language) { + $list[$id] = $this->t($language->getName()); + } + return $list; }