diff -u b/core/lib/Drupal/Core/Language/LanguageManager.php b/core/lib/Drupal/Core/Language/LanguageManager.php --- b/core/lib/Drupal/Core/Language/LanguageManager.php +++ b/core/lib/Drupal/Core/Language/LanguageManager.php @@ -40,7 +40,7 @@ /** * Constructs the language manager. * - * @param \Drupal\Core\Language\Language $default_language + * @param \Drupal\Core\Language\LanguageDefault $default_language * The default language. */ public function __construct(LanguageDefault $default_language) { diff -u b/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php b/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php --- b/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php @@ -15,7 +15,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\BaseFormIdInterface; use Drupal\Core\Form\FormBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\ConfigurableLanguageManagerInterface; use Drupal\locale\StringStorageInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -351,7 +351,7 @@ /** * Sets configuration based on a nested form value array. * - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * Set the configuration in this language. * @param \Drupal\Core\Config\Config $base_config * Base configuration values, in the source language. @@ -375,7 +375,7 @@ * @return array * Translation configuration override data. */ - protected function setConfig(Language $language, Config $base_config, Config $config_translation, array $config_values, $shipped_config = FALSE) { + protected function setConfig(LanguageInterface $language, Config $base_config, Config $config_translation, array $config_values, $shipped_config = FALSE) { foreach ($config_values as $key => $value) { if (is_array($value) && !isset($value['translation'])) { // Traverse into this level in the configuration. diff -u b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/DateFormat.php b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/DateFormat.php --- b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/DateFormat.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/DateFormat.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Ajax\ReplaceCommand; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Defines the date format element for the configuration translation interface. @@ -20,7 +20,7 @@ /** * {@inheritdoc} */ - public function getFormElement(array $definition, Language $language, $value) { + public function getFormElement(array $definition, LanguageInterface $language, $value) { if (class_exists('intlDateFormatter')) { $description = $this->t('A user-defined date format. See the PHP manual for available options.', array('@url' => 'http://userguide.icu-project.org/formatparse/datetime')); } diff -u b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textarea.php b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textarea.php --- b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textarea.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textarea.php @@ -7,7 +7,7 @@ namespace Drupal\config_translation\FormElement; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Defines the textarea element for the configuration translation interface. @@ -17,7 +17,7 @@ /** * {@inheritdoc} */ - public function getFormElement(array $definition, Language $language, $value) { + public function getFormElement(array $definition, LanguageInterface $language, $value) { // Estimate a comfortable size of the input textarea. $rows_words = ceil(str_word_count($value) / 5); $rows_newlines = substr_count($value, "\n" ) + 1; diff -u b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textfield.php b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textfield.php --- b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textfield.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textfield.php @@ -7,7 +7,7 @@ namespace Drupal\config_translation\FormElement; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Defines the textfield element for the configuration translation interface. @@ -17,7 +17,7 @@ /** * {@inheritdoc} */ - public function getFormElement(array $definition, Language $language, $value) { + public function getFormElement(array $definition, LanguageInterface $language, $value) { return array( '#type' => 'textfield', '#default_value' => $value, diff -u b/core/modules/content_translation/content_translation.pages.inc b/core/modules/content_translation/content_translation.pages.inc --- b/core/modules/content_translation/content_translation.pages.inc +++ b/core/modules/content_translation/content_translation.pages.inc @@ -5,7 +5,7 @@ * The content translation user interface. */ -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\ContentEntityInterface; @@ -154,12 +154,13 @@ * A renderable array of language switch links. */ function _content_translation_get_switch_links($path) { - $links = \Drupal::languageManager()->getLanguageSwitchLinks(Language::TYPE_CONTENT, $path); + $links = \Drupal::languageManager()->getLanguageSwitchLinks(LanguageInterface::TYPE_CONTENT, $path); if (empty($links)) { // If content language is set up to fall back to the interface language, - // then there will be no switch links for Language::TYPE_CONTENT, ergo we - // also need to use interface switch links. - $links = \Drupal::languageManager()->getLanguageSwitchLinks(Language::TYPE_INTERFACE, $path); + // then there will be no switch links for + // \Drupal\Core\Language\LanguageInterface::TYPE_CONTENT, ergo we also need + // to use interface switch links. + $links = \Drupal::languageManager()->getLanguageSwitchLinks(LanguageInterface::TYPE_INTERFACE, $path); } return $links; } @@ -169,10 +170,10 @@ * * @param EntityInterface $entity * The entity being translated. - * @param Language $source + * @param \Drupal\Core\Language\LanguageInterface $source * (optional) The language of the values being translated. Defaults to the * entity language. - * @param Language $target + * @param \Drupal\Core\Language\LanguageInterface $target * (optional) The language of the translated values. Defaults to the current * content language. * @@ -182,9 +183,9 @@ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. * Use \Drupal\content_translation\Controller\ContentTranslationController::add(). */ -function content_translation_add_page(EntityInterface $entity, Language $source = NULL, Language $target = NULL) { +function content_translation_add_page(EntityInterface $entity, LanguageInterface $source = NULL, LanguageInterface $target = NULL) { $source = !empty($source) ? $source : $entity->language(); - $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); + $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); // @todo Exploit the upcoming hook_entity_prepare() when available. content_translation_prepare_translation($entity, $source, $target); $form_state['langcode'] = $target->getId(); @@ -199,7 +200,7 @@ * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity being translated. - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * (optional) The language of the translated values. Defaults to the current * content language. * @@ -209,8 +210,8 @@ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. * Use \Drupal\content_translation\Controller\ContentTranslationController::edit(). */ -function content_translation_edit_page(EntityInterface $entity, Language $language = NULL) { - $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); +function content_translation_edit_page(EntityInterface $entity, LanguageInterface $language = NULL) { + $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); $form_state['langcode'] = $language->getId(); $form_state['content_translation']['translation_form'] = TRUE; return \Drupal::service('entity.form_builder')->getForm($entity, 'default', $form_state); @@ -221,12 +222,12 @@ * * @param \Drupal\Core\Entity\EntityInterface $entity * The entitiy being translated. - * @param \Drupal\Core\Language\Language $source + * @param \Drupal\Core\Language\LanguageInterface $source * The language to be used as source. - * @param \Drupal\Core\Language\Language $target + * @param \Drupal\Core\Language\LanguageInterface $target * The language to be used as target. */ -function content_translation_prepare_translation(EntityInterface $entity, Language $source, Language $target) { +function content_translation_prepare_translation(EntityInterface $entity, LanguageInterface $source, LanguageInterface $target) { if ($entity instanceof ContentEntityInterface) { $source_translation = $entity->getTranslation($source->getId()); $entity->addTranslation($target->getId(), $source_translation->toArray()); diff -u b/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverride.php b/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverride.php --- b/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverride.php +++ b/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverride.php @@ -10,7 +10,7 @@ use Drupal\Core\Config\Config; use Drupal\Core\Config\StorageInterface; use Drupal\Core\Config\TypedConfigManagerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageDefault; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -152,7 +152,7 @@ /** * {@inheritdoc} */ - public function setLanguage(Language $language = NULL) { + public function setLanguage(LanguageInterface $language = NULL) { $this->language = $language; return $this; } diff -u b/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodBase.php b/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodBase.php --- b/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodBase.php +++ b/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodBase.php @@ -8,7 +8,7 @@ namespace Drupal\language; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; /** @@ -61,7 +61,7 @@ /** * {@inheritdoc} */ - public function persist(Language $language) { + public function persist(LanguageInterface $language) { // Remember the method ID used to detect the language. $language->setNegotiationMethodId(static::METHOD_ID); } diff -u b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php --- b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php @@ -7,7 +7,7 @@ namespace Drupal\language\Plugin\LanguageNegotiation; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; use Drupal\language\LanguageNegotiationMethodBase; use Drupal\language\LanguageSwitcherInterface; @@ -68,12 +68,12 @@ /** * {@inheritdoc} */ - public function persist(Language $language) { + public function persist(LanguageInterface $language) { parent::persist($language); // We need to update the session parameter with the request value only if we // have an authenticated user. - $langcode = $language->id; + $langcode = $language->getId(); if ($langcode && $this->languageManager) { $languages = $this->languageManager->getLanguages(); if ($this->currentUser->isAuthenticated() && isset($languages[$langcode])) { @@ -132,10 +132,10 @@ parse_str($request->getQueryString(), $query); foreach ($this->languageManager->getLanguages() as $language) { - $langcode = $language->id; + $langcode = $language->getId(); $links[$langcode] = array( 'href' => $path, - 'title' => $language->name, + 'title' => $language->getName(), 'attributes' => array('class' => array('language-link')), 'query' => $query, ); only in patch2: unchanged: --- a/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php +++ b/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php @@ -8,7 +8,7 @@ namespace Drupal\Core\Config; use Drupal\Component\Utility\NestedArray; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\EventDispatcher\Event; /** @@ -42,10 +42,10 @@ class ConfigModuleOverridesEvent extends Event { * * @param array $names * A list of configuration names. - * @param \Drupal\Core\Language\Language + * @param \Drupal\Core\Language\LanguageInterface * (optional) The language for this configuration. */ - public function __construct(array $names, Language $language = NULL) { + public function __construct(array $names, LanguageInterface $language = NULL) { $this->names = $names; $this->language = $language; $this->overrides = array(); only in patch2: unchanged: --- a/core/lib/Drupal/Core/PathProcessor/PathProcessorAlias.php +++ b/core/lib/Drupal/Core/PathProcessor/PathProcessorAlias.php @@ -45,7 +45,7 @@ public function processInbound($path, Request $request) { */ public function processOutbound($path, &$options = array(), Request $request = NULL) { if (empty($options['alias'])) { - $langcode = isset($options['language']) ? $options['language']->id : NULL; + $langcode = isset($options['language']) ? $options['language']->getId() : NULL; $path = $this->aliasManager->getPathAlias($path, $langcode); } return $path; only in patch2: unchanged: --- a/core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperInterface.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperInterface.php @@ -7,7 +7,7 @@ namespace Drupal\config_translation; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\HttpFoundation\Request; /** @@ -260,14 +260,14 @@ public function hasTranslatable(); /** * Checks whether there is already a translation for this mapper. * - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * A language object. * * @return bool * TRUE if any of the configuration elements have a translation in the * given language, FALSE otherwise. */ - public function hasTranslation(Language $language); + public function hasTranslation(LanguageInterface $language); /** * Populate the config mapper with request data. only in patch2: unchanged: --- a/core/modules/config_translation/lib/Drupal/config_translation/ConfigNamesMapper.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/ConfigNamesMapper.php @@ -9,6 +9,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Plugin\PluginBase; use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\StringTranslation\TranslationInterface; @@ -413,7 +414,7 @@ public function hasTranslatable() { /** * {@inheritdoc} */ - public function hasTranslation(Language $language) { + public function hasTranslation(LanguageInterface $language) { foreach ($this->getConfigNames() as $name) { if ($this->localeConfigManager->hasTranslation($name, $language)) { return TRUE; only in patch2: unchanged: --- a/core/modules/config_translation/lib/Drupal/config_translation/FormElement/ElementInterface.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/ElementInterface.php @@ -7,7 +7,7 @@ namespace Drupal\config_translation\FormElement; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Provides an interface for configuration translation form elements. @@ -19,7 +19,7 @@ * * @param array $definition * Configuration schema type definition of the element. - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * Language object to display the translation form for. * @param string $value * Default value for the form element. @@ -27,6 +27,6 @@ * @return array * Form API array to represent the form element. */ - public function getFormElement(array $definition, Language $language, $value); + public function getFormElement(array $definition, LanguageInterface $language, $value); } only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverrideInterface.php +++ b/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverrideInterface.php @@ -8,7 +8,7 @@ namespace Drupal\language\Config; use Drupal\Core\Config\ConfigFactoryOverrideInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageDefault; /** @@ -32,12 +32,12 @@ public function getLanguage(); /** * Sets the language to be used in configuration overrides. * - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * The language object used to override configuration data. * * @return $this */ - public function setLanguage(Language $language = NULL); + public function setLanguage(LanguageInterface $language = NULL); /** * Sets the language to be used in configuration overrides from the default. only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodInterface.php +++ b/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodInterface.php @@ -8,7 +8,7 @@ namespace Drupal\language; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\HttpFoundation\Request; @@ -57,9 +57,9 @@ public function getLangcode(Request $request = NULL); /** * Notifies the plugin that the language code it returned has been accepted. * - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * The accepted language. */ - public function persist(Language $language); + public function persist(LanguageInterface $language); } only in patch2: unchanged: --- a/core/modules/update/update.fetch.inc +++ b/core/modules/update/update.fetch.inc @@ -110,7 +110,7 @@ function _update_cron_notify() { if (!empty($params)) { $notify_list = $update_config->get('notification.emails'); if (!empty($notify_list)) { - $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->id; + $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId(); foreach ($notify_list as $target) { if ($target_user = user_load_by_mail($target)) { $target_langcode = $target_user->getPreferredLangcode(); only in patch2: unchanged: --- a/core/modules/user/lib/Drupal/user/Entity/User.php +++ b/core/modules/user/lib/Drupal/user/Entity/User.php @@ -383,10 +383,10 @@ function getPreferredLangcode($default = NULL) { $language_list = language_list(); $preferred_langcode = $this->get('preferred_langcode')->value; if (!empty($preferred_langcode) && isset($language_list[$preferred_langcode])) { - return $language_list[$preferred_langcode]->id; + return $language_list[$preferred_langcode]->getId(); } else { - return $default ? $default : language_default()->id; + return $default ? $default : language_default()->getId(); } } @@ -397,10 +397,10 @@ function getPreferredAdminLangcode($default = NULL) { $language_list = language_list(); $preferred_langcode = $this->get('preferred_admin_langcode')->value; if (!empty($preferred_langcode) && isset($language_list[$preferred_langcode])) { - return $language_list[$preferred_langcode]->id; + return $language_list[$preferred_langcode]->getId(); } else { - return $default ? $default : language_default()->id; + return $default ? $default : language_default()->getId(); } }