diff -u b/core/modules/language/tests/language_test/language_test.module b/core/modules/language/tests/language_test/language_test.module --- b/core/modules/language/tests/language_test/language_test.module +++ b/core/modules/language/tests/language_test/language_test.module @@ -13,7 +13,7 @@ */ function language_test_page_build() { language_test_store_language_negotiation(); - if (isset(\Drupal::languageManager()->getCurrentLanguage()->id) && isset(\Drupal::languageManager()->getCurrentLanguage()->getNegotiationMethodId())) { + if (\Drupal::languageManager()->getCurrentLanguage()->getId() && \Drupal::languageManager()->getCurrentLanguage()->getNegotiationMethodId()) { drupal_set_message(t('Language negotiation method: @name', array('@name' => \Drupal::languageManager()->getCurrentLanguage()->getNegotiationMethodId()))); } } @@ -69,7 +69,7 @@ if (\Drupal::moduleHandler()->moduleExists('language')) { $last = array(); foreach (\Drupal::languageManager()->getDefinedLanguageTypes() as $type) { - $last[$type] = \Drupal::languageManager()->getCurrentLanguage($type)->id; + $last[$type] = \Drupal::languageManager()->getCurrentLanguage($type)->getId(); } \Drupal::state()->set('language_test.language_negotiation_last', $last); } only in patch2: unchanged: --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -672,7 +672,7 @@ function filter_xss_bad_protocol($string) { * Arbitrary elements may be added using the $args associative array. */ function format_rss_channel($title, $link, $description, $items, $langcode = NULL, $args = array()) { - $langcode = $langcode ? $langcode : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->id; + $langcode = $langcode ? $langcode : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->getId(); $output = "\n"; $output .= ' ' . String::checkPlain($title) . "\n"; @@ -2076,7 +2076,7 @@ function _drupal_add_js($data = NULL, $options = NULL) { 'currentPath' => $current_path, 'currentPathIsAdmin' => $current_path_is_admin, 'isFront' => drupal_is_front_page(), - 'currentLanguage' => \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_URL)->id, + 'currentLanguage' => \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_URL)->getId(), ); if (!empty($current_query)) { ksort($current_query); only in patch2: unchanged: --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -1988,7 +1988,7 @@ function form_process_machine_name($element, &$form_state) { 'machineName' => array( '#' . $source['#id'] => $element['#machine_name'], ), - 'langcode' => $language->id, + 'langcode' => $language->getId(), ), ); $element['#attached']['library'][] = 'core/drupal.machine-name'; only in patch2: unchanged: --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2099,7 +2099,7 @@ function template_preprocess_page(&$variables) { $variables['front_page'] = url(); $variables['feed_icons'] = drupal_get_feeds(); $variables['language'] = $language_interface; - $variables['language']->dir = $language_interface->direction ? 'rtl' : 'ltr'; + $variables['language']->dir = $language_interface->getDirection() ? 'rtl' : 'ltr'; $variables['logo'] = theme_get_setting('logo.url'); $variables['main_menu'] = theme_get_setting('features.main_menu') ? menu_main_menu() : array(); $variables['secondary_menu'] = theme_get_setting('features.secondary_menu') ? menu_secondary_menu() : array(); @@ -2247,8 +2247,8 @@ function template_preprocess_maintenance_page(&$variables) { $variables['html_attributes'] = new Attribute; // HTML element attributes. - $variables['html_attributes']['lang'] = $language_interface->id; - $variables['html_attributes']['dir'] = $language_interface->direction ? 'rtl' : 'ltr'; + $variables['html_attributes']['lang'] = $language_interface->getId(); + $variables['html_attributes']['dir'] = $language_interface->getDirection() ? 'rtl' : 'ltr'; // Add favicon if (theme_get_setting('features.favicon')) { only in patch2: unchanged: --- a/core/lib/Drupal/Core/Cache/LanguageCacheContext.php +++ b/core/lib/Drupal/Core/Cache/LanguageCacheContext.php @@ -45,7 +45,7 @@ public function getContext() { $context_parts = array(); if ($this->languageManager->isMultilingual()) { foreach ($this->languageManager->getLanguageTypes() as $type) { - $context_parts[] = $this->languageManager->getCurrentLanguage($type)->id; + $context_parts[] = $this->languageManager->getCurrentLanguage($type)->getId(); } } return implode(':', $context_parts); only in patch2: unchanged: --- a/core/lib/Drupal/Core/Datetime/Date.php +++ b/core/lib/Drupal/Core/Datetime/Date.php @@ -130,7 +130,7 @@ public function format($timestamp, $type = 'medium', $format = '', $timezone = N } if (empty($langcode)) { - $langcode = $this->languageManager->getCurrentLanguage()->id; + $langcode = $this->languageManager->getCurrentLanguage()->getId(); } // Create a DrupalDateTime object from the timestamp and timezone. only in patch2: unchanged: --- a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php +++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php @@ -53,7 +53,7 @@ class DrupalDateTime extends DateTimePlus { public function __construct($time = 'now', $timezone = NULL, $settings = array()) { // We can set the langcode and country using Drupal values. if (!isset($settings['langcode'])) { - $settings['langcode'] = \Drupal::languageManager()->getCurrentLanguage()->id; + $settings['langcode'] = \Drupal::languageManager()->getCurrentLanguage()->getId(); } if (!isset($settings['country'])) { only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -37,7 +37,7 @@ public function id(); /** * Returns the language of the entity. * - * @return \Drupal\Core\Language\Language + * @return \Drupal\Core\Language\LanguageInterface * The language object. */ public function language(); only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -157,7 +157,7 @@ public function __construct(\Traversable $namespaces, ContainerInterface $contai $this->discovery = new AnnotatedClassDiscovery('Entity', $namespaces, 'Drupal\Core\Entity\Annotation\EntityType'); $this->discovery = new InfoHookDecorator($this->discovery, 'entity_type_build'); $this->discovery = new AlterDecorator($this->discovery, 'entity_type'); - $this->discovery = new CacheDecorator($this->discovery, 'entity_type:' . $this->languageManager->getCurrentLanguage()->id, 'default', Cache::PERMANENT, array('entity_types' => TRUE)); + $this->discovery = new CacheDecorator($this->discovery, 'entity_type:' . $this->languageManager->getCurrentLanguage()->getId(), 'default', Cache::PERMANENT, array('entity_types' => TRUE)); $this->container = $container; } @@ -314,7 +314,7 @@ public function getBaseFieldDefinitions($entity_type_id) { // Check the static cache. if (!isset($this->baseFieldDefinitions[$entity_type_id])) { // Not prepared, try to load from cache. - $cid = 'entity_base_field_definitions:' . $entity_type_id . ':' . $this->languageManager->getCurrentLanguage()->id; + $cid = 'entity_base_field_definitions:' . $entity_type_id . ':' . $this->languageManager->getCurrentLanguage()->getId(); if ($cache = $this->cache->get($cid)) { $this->baseFieldDefinitions[$entity_type_id] = $cache->data; } @@ -404,7 +404,7 @@ public function getFieldDefinitions($entity_type_id, $bundle) { if (!isset($this->fieldDefinitions[$entity_type_id][$bundle])) { $base_field_definitions = $this->getBaseFieldDefinitions($entity_type_id); // Not prepared, try to load from cache. - $cid = 'entity_bundle_field_definitions:' . $entity_type_id . ':' . $bundle . ':' . $this->languageManager->getCurrentLanguage()->id; + $cid = 'entity_bundle_field_definitions:' . $entity_type_id . ':' . $bundle . ':' . $this->languageManager->getCurrentLanguage()->getId(); if ($cache = $this->cache->get($cid)) { $bundle_field_definitions = $cache->data; } @@ -505,7 +505,7 @@ public function getBundleInfo($entity_type) { */ public function getAllBundleInfo() { if (!isset($this->bundleInfo)) { - $langcode = $this->languageManager->getCurrentLanguage()->id; + $langcode = $this->languageManager->getCurrentLanguage()->getId(); if ($cache = $this->cache->get("entity_bundle_info:$langcode")) { $this->bundleInfo = $cache->data; } @@ -537,7 +537,7 @@ public function getExtraFields($entity_type_id, $bundle) { // Read from the persistent cache. Since hook_entity_extra_field_info() and // hook_entity_extra_field_info_alter() might contain t() calls, we cache // per language. - $cache_id = 'entity_bundle_extra_fields:' . $entity_type_id . ':' . $bundle . ':' . $this->languageManager->getCurrentLanguage()->id; + $cache_id = 'entity_bundle_extra_fields:' . $entity_type_id . ':' . $bundle . ':' . $this->languageManager->getCurrentLanguage()->getId(); $cached = $this->cache->get($cache_id); if ($cached) { $this->extraFields[$entity_type_id][$bundle] = $cached->data; @@ -581,7 +581,7 @@ public function getTranslationFromContext(EntityInterface $entity, $langcode = N if ($entity instanceof TranslatableInterface) { if (empty($langcode)) { - $langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->id; + $langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->getId(); } // Retrieve language fallback candidates to perform the entity language @@ -592,7 +592,7 @@ public function getTranslationFromContext(EntityInterface $entity, $langcode = N // Ensure the default language has the proper language code. $default_language = $entity->getUntranslated()->language(); - $candidates[$default_language->id] = Language::LANGCODE_DEFAULT; + $candidates[$default_language->getId()] = Language::LANGCODE_DEFAULT; // Return the most fitting entity translation. foreach ($candidates as $candidate) { @@ -646,7 +646,7 @@ public function getFormModes($entity_type_id) { protected function getAllDisplayModesByEntityType($display_type) { if (!isset($this->displayModeInfo[$display_type])) { $key = 'entity_' . $display_type . '_info'; - $langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_INTERFACE)->id; + $langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_INTERFACE)->getId(); if ($cache = $this->cache->get("$key:$langcode")) { $this->displayModeInfo[$display_type] = $cache->data; } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -205,7 +205,7 @@ public function view(EntityInterface $entity, $view_mode = 'full', $langcode = N */ public function viewMultiple(array $entities = array(), $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { - $langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->id; + $langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->getId(); } // Build the view modes and display objects. only in patch2: unchanged: --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -55,7 +55,7 @@ public function onRespond(FilterResponseEvent $event) { $response->headers->set('X-UA-Compatible', 'IE=edge,chrome=1', FALSE); // Set the Content-language header. - $response->headers->set('Content-language', $this->languageManager->getCurrentLanguage()->id); + $response->headers->set('Content-language', $this->languageManager->getCurrentLanguage()->getId()); // Because pages are highly dynamic, set the last-modified time to now // since the page is in fact being regenerated right now. only in patch2: unchanged: --- a/core/lib/Drupal/Core/Path/AliasManager.php +++ b/core/lib/Drupal/Core/Path/AliasManager.php @@ -95,7 +95,7 @@ public function getSystemPath($path, $path_language = NULL) { // language. If we used a language different from the one conveyed by the // requested URL, we might end up being unable to check if there is a path // alias matching the URL path. - $path_language = $path_language ?: $this->languageManager->getCurrentLanguage(Language::TYPE_URL)->id; + $path_language = $path_language ?: $this->languageManager->getCurrentLanguage(Language::TYPE_URL)->getId(); // Lookup the path alias first. if (!empty($path) && $source = $this->lookupPathSource($path, $path_language)) { $path = $source; @@ -112,7 +112,7 @@ public function getPathAlias($path, $path_language = NULL) { // language. If we used a language different from the one conveyed by the // requested URL, we might end up being unable to check if there is a path // alias matching the URL path. - $path_language = $path_language ?: $this->languageManager->getCurrentLanguage(Language::TYPE_URL)->id; + $path_language = $path_language ?: $this->languageManager->getCurrentLanguage(Language::TYPE_URL)->getId(); $result = $path; if (!empty($path) && $alias = $this->lookupPathAlias($path, $path_language)) { $result = $alias; only in patch2: unchanged: --- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -146,7 +146,7 @@ public function setCacheBackend(CacheBackendInterface $cache_backend, LanguageMa $this->languageManager = $language_manager; $this->cacheBackend = $cache_backend; $this->cacheKeyPrefix = $cache_key_prefix; - $this->cacheKey = $cache_key_prefix . ':' . $language_manager->getCurrentLanguage()->id; + $this->cacheKey = $cache_key_prefix . ':' . $language_manager->getCurrentLanguage()->getId(); $this->cacheTags = $cache_tags; } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Validation/DrupalTranslator.php +++ b/core/lib/Drupal/Core/Validation/DrupalTranslator.php @@ -56,7 +56,7 @@ public function setLocale($locale) { * Implements \Symfony\Component\Translation\TranslatorInterface::getLocale(). */ public function getLocale() { - return $this->locale ? $this->locale : \Drupal::languageManager()->getCurrentLanguage()->id; + return $this->locale ? $this->locale : \Drupal::languageManager()->getCurrentLanguage()->getId(); } /** only in patch2: unchanged: --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php @@ -102,7 +102,7 @@ public function form(array $form, array &$form_state) { // Set the correct default language. if ($block->isNew()) { $language_default = $this->languageManager->getCurrentLanguage($language_configuration['langcode']); - $block->langcode->value = $language_default->id; + $block->langcode->value = $language_default->getId(); } } only in patch2: unchanged: --- a/core/modules/block/lib/Drupal/block/BlockAccessController.php +++ b/core/modules/block/lib/Drupal/block/BlockAccessController.php @@ -117,7 +117,7 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A // Language visibility settings. if (!empty($visibility['language']['langcodes']) && array_filter($visibility['language']['langcodes'])) { - if (empty($visibility['language']['langcodes'][\Drupal::languageManager()->getCurrentLanguage($visibility['language']['language_type'])->id])) { + if (empty($visibility['language']['langcodes'][\Drupal::languageManager()->getCurrentLanguage($visibility['language']['language_type'])->getId()])) { return FALSE; } } only in patch2: unchanged: --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -488,13 +488,13 @@ function template_preprocess_book_export_html(&$variables) { $variables['title'] = String::checkPlain($variables['title']); $variables['base_url'] = $base_url; $variables['language'] = $language_interface; - $variables['language_rtl'] = ($language_interface->direction == Language::DIRECTION_RTL); + $variables['language_rtl'] = ($language_interface->getDirection() == Language::DIRECTION_RTL); $variables['head'] = drupal_get_html_head(); // HTML element attributes. $attributes = array(); - $attributes['lang'] = $language_interface->id; - $attributes['dir'] = $language_interface->direction ? 'rtl' : 'ltr'; + $attributes['lang'] = $language_interface->getId(); + $attributes['dir'] = $language_interface->getDirection() ? 'rtl' : 'ltr'; $variables['html_attributes'] = new Attribute($attributes); } only in patch2: unchanged: --- a/core/modules/book/lib/Drupal/book/BookManager.php +++ b/core/modules/book/lib/Drupal/book/BookManager.php @@ -479,7 +479,7 @@ public function bookTreeAllData($bid, $link = NULL, $max_depth = NULL) { $nid = isset($link['nid']) ? $link['nid'] : 0; // Generate a cache ID (cid) specific for this $bid, $link, $language, and // depth. - $cid = 'book-links:' . $bid . ':all:' . $nid . ':' . $language_interface->id . ':' . (int) $max_depth; + $cid = 'book-links:' . $bid . ':all:' . $nid . ':' . $language_interface->getId() . ':' . (int) $max_depth; if (!isset($tree[$cid])) { // If the tree data was not in the static cache, build $tree_parameters. @@ -632,7 +632,7 @@ protected function doBookTreeBuild($bid, array $parameters = array()) { if (isset($parameters['expanded'])) { sort($parameters['expanded']); } - $tree_cid = 'book-links:' . $bid . ':tree-data:' . $language_interface->id . ':' . hash('sha256', serialize($parameters)); + $tree_cid = 'book-links:' . $bid . ':tree-data:' . $language_interface->getId() . ':' . hash('sha256', serialize($parameters)); // If we do not have this tree in the static cache, check {cache_data}. if (!isset($trees[$tree_cid])) { only in patch2: unchanged: --- a/core/modules/ckeditor/ckeditor.admin.inc +++ b/core/modules/ckeditor/ckeditor.admin.inc @@ -21,7 +21,7 @@ function template_preprocess_ckeditor_settings_toolbar(&$variables) { // Simplify the language direction information for toolbar buttons. $language_interface = \Drupal::languageManager()->getCurrentLanguage(); - $language_direction = $language_interface->direction ? 'rtl' : 'ltr'; + $language_direction = $language_interface->getDirection() ? 'rtl' : 'ltr'; // Create lists of active and disabled buttons. $editor = $variables['editor']; only in patch2: unchanged: --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php @@ -269,8 +269,8 @@ public function getJSSettings(EditorEntity $editor) { // Map the interface language code to a CKEditor translation. $ckeditor_langcodes = $this->getLangcodes(); $language_interface = $this->languageManager->getCurrentLanguage(); - if (isset($ckeditor_langcodes[$language_interface->id])) { - $display_langcode = $ckeditor_langcodes[$language_interface->id]; + if (isset($ckeditor_langcodes[$language_interface->getId()])) { + $display_langcode = $ckeditor_langcodes[$language_interface->getId()]; } // Next, set the most fundamental CKEditor settings. only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php @@ -75,7 +75,7 @@ protected function init(array &$form_state) { // set. if ($comment->isNew()) { $language_content = \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); - $comment->langcode->value = $language_content->id; + $comment->langcode->value = $language_content->getId(); } parent::init($form_state); only in patch2: unchanged: --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php @@ -63,8 +63,8 @@ function testCommentTokenReplacement() { $tests['[comment:body]'] = $comment->comment_body->processed; $tests['[comment:url]'] = url('comment/' . $comment->id(), $url_options + array('fragment' => 'comment-' . $comment->id())); $tests['[comment:edit-url]'] = url('comment/' . $comment->id() . '/edit', $url_options); - $tests['[comment:created:since]'] = format_interval(REQUEST_TIME - $comment->getCreatedTime(), 2, $language_interface->id); - $tests['[comment:changed:since]'] = format_interval(REQUEST_TIME - $comment->getChangedTime(), 2, $language_interface->id); + $tests['[comment:created:since]'] = format_interval(REQUEST_TIME - $comment->getCreatedTime(), 2, $language_interface->getId()); + $tests['[comment:changed:since]'] = format_interval(REQUEST_TIME - $comment->getChangedTime(), 2, $language_interface->getId()); $tests['[comment:parent:cid]'] = $comment->hasParentComment() ? $comment->getParentComment()->id() : NULL; $tests['[comment:parent:title]'] = check_plain($parent_comment->getSubject()); $tests['[comment:node:nid]'] = $comment->getCommentedEntityId(); @@ -76,7 +76,7 @@ function testCommentTokenReplacement() { $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('comment' => $comment), array('langcode' => $language_interface->id)); + $output = $token_service->replace($input, array('comment' => $comment), array('langcode' => $language_interface->getId())); $this->assertEqual($output, $expected, format_string('Sanitized comment token %token replaced.', array('%token' => $input))); } @@ -93,7 +93,7 @@ function testCommentTokenReplacement() { $tests['[comment:author:name]'] = $this->admin_user->getUsername(); foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('comment' => $comment), array('langcode' => $language_interface->id, 'sanitize' => FALSE)); + $output = $token_service->replace($input, array('comment' => $comment), array('langcode' => $language_interface->getId(), 'sanitize' => FALSE)); $this->assertEqual($output, $expected, format_string('Unsanitized comment token %token replaced.', array('%token' => $input))); } @@ -108,7 +108,7 @@ function testCommentTokenReplacement() { $tests['[node:comment-count]'] = 2; foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('entity' => $node, 'node' => $node), array('langcode' => $language_interface->id)); + $output = $token_service->replace($input, array('entity' => $node, 'node' => $node), array('langcode' => $language_interface->getId())); $this->assertEqual($output, $expected, format_string('Node comment token %token replaced.', array('%token' => $input))); } } only in patch2: unchanged: --- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php +++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php @@ -213,7 +213,7 @@ public function save(array $form, array &$form_state) { $params['contact_category'] = $category; $to = implode(', ', $category->recipients); - $recipient_langcode = language_default()->id; + $recipient_langcode = language_default()->getId(); } elseif ($recipient = $message->getPersonalRecipient()) { // Send to the user in the user's preferred language. @@ -231,14 +231,14 @@ public function save(array $form, array &$form_state) { // If requested, send a copy to the user, using the current language. if ($message->copySender()) { - drupal_mail('contact', $key_prefix . '_copy', $sender->getEmail(), $language_interface->id, $params, $sender->getEmail()); + drupal_mail('contact', $key_prefix . '_copy', $sender->getEmail(), $language_interface->getId(), $params, $sender->getEmail()); } // If configured, send an auto-reply, using the current language. if (!$message->isPersonal() && $category->reply) { // User contact forms do not support an auto-reply message, so this // message always originates from the site. - drupal_mail('contact', 'page_autoreply', $sender->getEmail(), $language_interface->id, $params); + drupal_mail('contact', 'page_autoreply', $sender->getEmail(), $language_interface->getId(), $params); } $config = $this->configFactory->get('contact.settings'); only in patch2: unchanged: --- a/core/modules/content_translation/content_translation.pages.inc +++ b/core/modules/content_translation/content_translation.pages.inc @@ -110,7 +110,7 @@ function content_translation_overview(EntityInterface $entity) { else { // No such translation in the set yet: help user to create it. $row_title = $source_name = t('n/a'); - $source = $entity->language()->id; + $source = $entity->language()->getId(); if ($source != $langcode && $controller->getTranslationAccess($entity, 'create')) { if ($translatable) { @@ -187,7 +187,7 @@ function content_translation_add_page(EntityInterface $entity, Language $source $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); // @todo Exploit the upcoming hook_entity_prepare() when available. content_translation_prepare_translation($entity, $source, $target); - $form_state['langcode'] = $target->id; + $form_state['langcode'] = $target->getId(); $form_state['content_translation']['source'] = $source; $form_state['content_translation']['target'] = $target; $form_state['content_translation']['translation_form'] = !$entity->access('update'); @@ -211,7 +211,7 @@ function content_translation_add_page(EntityInterface $entity, Language $source */ function content_translation_edit_page(EntityInterface $entity, Language $language = NULL) { $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); - $form_state['langcode'] = $language->id; + $form_state['langcode'] = $language->getId(); $form_state['content_translation']['translation_form'] = TRUE; return \Drupal::service('entity.form_builder')->getForm($entity, 'default', $form_state); } @@ -228,7 +228,7 @@ function content_translation_edit_page(EntityInterface $entity, Language $langua */ function content_translation_prepare_translation(EntityInterface $entity, Language $source, Language $target) { if ($entity instanceof ContentEntityInterface) { - $source_translation = $entity->getTranslation($source->id); - $entity->addTranslation($target->id, $source_translation->toArray()); + $source_translation = $entity->getTranslation($source->getId()); + $entity->addTranslation($target->getId(), $source_translation->toArray()); } } only in patch2: unchanged: --- a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php @@ -57,10 +57,10 @@ public function access(Route $route, Request $request, AccountInterface $account $target = language_load($request->attributes->get('target')); $source = !empty($source) ? $source : $entity->language(); $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); - return ($source->id != $target->id - && isset($languages[$source->id]) - && isset($languages[$target->id]) - && !isset($translations[$target->id]) + return ($source->getId() != $target->getId() + && isset($languages[$source->getId()]) + && isset($languages[$target->getId()]) + && !isset($translations[$target->getId()]) && $controller->getTranslationAccess($entity, $operation)) ? static::ALLOW : static::DENY; @@ -68,9 +68,9 @@ public function access(Route $route, Request $request, AccountInterface $account case 'delete': $language = language_load($request->attributes->get('language')); $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); - return isset($languages[$language->id]) - && $language->id != $entity->getUntranslated()->language()->id - && isset($translations[$language->id]) + return isset($languages[$language->getId()]) + && $language->getId() != $entity->getUntranslated()->language()->id + && isset($translations[$language->getId()]) && $controller->getTranslationAccess($entity, $operation) ? static::ALLOW : static::DENY; } only in patch2: unchanged: --- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php @@ -255,7 +255,7 @@ public function query($use_groupby = FALSE) { $column = $this->tableAlias . '.langcode'; // By the same reason as field_language the field might be Language::LANGCODE_NOT_SPECIFIED in reality so allow it as well. // @see this::field_langcode() - $default_langcode = language_default()->id; + $default_langcode = language_default()->getId(); $langcode = str_replace( array('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***'), array($this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT), $default_langcode), @@ -861,7 +861,7 @@ protected function addSelfTokens(&$tokens, $item) { */ function field_langcode(EntityInterface $entity) { if ($this->field_info->isTranslatable()) { - $default_langcode = language_default()->id; + $default_langcode = language_default()->getId(); $langcode = str_replace( array('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***'), array($this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT), $default_langcode), @@ -873,7 +873,7 @@ function field_langcode(EntityInterface $entity) { // for the selected language. FieldItemListInterface::view() does this as // well, but since the returned language code is used before calling it, // the fallback needs to happen explicitly. - $langcode = $this->entityManager->getTranslationFromContext($entity, $langcode)->language()->id; + $langcode = $this->entityManager->getTranslationFromContext($entity, $langcode)->language()->getId(); return $langcode; } only in patch2: unchanged: --- a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php @@ -53,10 +53,10 @@ function testFileTokenReplacement() { $tests['[file:mime]'] = check_plain($file->getMimeType()); $tests['[file:size]'] = format_size($file->getSize()); $tests['[file:url]'] = check_plain(file_create_url($file->getFileUri())); - $tests['[file:created]'] = format_date($file->getCreatedTime(), 'medium', '', NULL, $language_interface->id); - $tests['[file:created:short]'] = format_date($file->getCreatedTime(), 'short', '', NULL, $language_interface->id); - $tests['[file:changed]'] = format_date($file->getChangedTime(), 'medium', '', NULL, $language_interface->id); - $tests['[file:changed:short]'] = format_date($file->getChangedTime(), 'short', '', NULL, $language_interface->id); + $tests['[file:created]'] = format_date($file->getCreatedTime(), 'medium', '', NULL, $language_interface->getId()); + $tests['[file:created:short]'] = format_date($file->getCreatedTime(), 'short', '', NULL, $language_interface->getId()); + $tests['[file:changed]'] = format_date($file->getChangedTime(), 'medium', '', NULL, $language_interface->getId()); + $tests['[file:changed:short]'] = format_date($file->getChangedTime(), 'short', '', NULL, $language_interface->getId()); $tests['[file:owner]'] = check_plain(user_format_name($this->admin_user)); $tests['[file:owner:uid]'] = $file->getOwnerId(); @@ -64,7 +64,7 @@ function testFileTokenReplacement() { $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('file' => $file), array('langcode' => $language_interface->id)); + $output = $token_service->replace($input, array('file' => $file), array('langcode' => $language_interface->getId())); $this->assertEqual($output, $expected, format_string('Sanitized file token %token replaced.', array('%token' => $input))); } @@ -75,7 +75,7 @@ function testFileTokenReplacement() { $tests['[file:size]'] = format_size($file->getSize()); foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('file' => $file), array('langcode' => $language_interface->id, 'sanitize' => FALSE)); + $output = $token_service->replace($input, array('file' => $file), array('langcode' => $language_interface->getId(), 'sanitize' => FALSE)); $this->assertEqual($output, $expected, format_string('Unsanitized file token %token replaced.', array('%token' => $input))); } } only in patch2: unchanged: --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -142,13 +142,13 @@ function filter_formats(AccountInterface $account = NULL) { // All available formats are cached for performance. if (!isset($formats['all'])) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); - if ($cache = \Drupal::cache()->get("filter_formats:{$language_interface->id}")) { + if ($cache = \Drupal::cache()->get("filter_formats:{$language_interface->getId()}")) { $formats['all'] = $cache->data; } else { $formats['all'] = \Drupal::entityManager()->getStorage('filter_format')->loadByProperties(array('status' => TRUE)); uasort($formats['all'], 'Drupal\Core\Config\Entity\ConfigEntityBase::sort'); - \Drupal::cache()->set("filter_formats:{$language_interface->id}", $formats['all'], Cache::PERMANENT, array('filter_formats' => TRUE)); + \Drupal::cache()->set("filter_formats:{$language_interface->getId()}", $formats['all'], Cache::PERMANENT, array('filter_formats' => TRUE)); } } only in patch2: unchanged: --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -203,7 +203,7 @@ function language_element_info() { */ function language_configuration_element_default_options() { $language_options = array( - 'site_default' => t("Site's default language (!language)", array('!language' => \Drupal::languageManager()->getDefaultLanguage()->name)), + 'site_default' => t("Site's default language (!language)", array('!language' => \Drupal::languageManager()->getDefaultLanguage()->getName())), 'current_interface' => t('Current interface language'), 'authors_default' => t("Author's preferred language"), ); @@ -383,11 +383,11 @@ function language_get_default_langcode($entity_type, $bundle) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); switch ($configuration['langcode']) { case 'site_default': - $default_value = \Drupal::languageManager()->getDefaultLanguage()->id; + $default_value = \Drupal::languageManager()->getDefaultLanguage()->getId(); break; case 'current_interface': - $default_value = $language_interface->id; + $default_value = $language_interface->getId(); break; case 'authors_default': @@ -397,7 +397,7 @@ function language_get_default_langcode($entity_type, $bundle) { $default_value = $language_code; } else { - $default_value = $language_interface->id; + $default_value = $language_interface->getId(); } break; } @@ -688,7 +688,7 @@ function language_form_system_regional_settings_alter(&$form, &$form_state) { $form['locale']['site_default_language'] = array( '#type' => 'select', '#title' => t('Default language'), - '#default_value' => $default->id, + '#default_value' => $default->getId(), '#options' => $language_options, '#description' => t('It is not recommended to change the default language on a working site. Configure the Selected language setting on the detection and selection page to change the fallback language for language selection.', array('@language-detection' => url('admin/config/regional/language/detection'))), '#weight' => -1, only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/EventSubscriber/LanguageRequestSubscriber.php +++ b/core/modules/language/lib/Drupal/language/EventSubscriber/LanguageRequestSubscriber.php @@ -86,7 +86,7 @@ public function onKernelRequestLanguage(GetResponseEvent $event) { } // After the language manager has initialized, set the default langcode // for the string translations. - $langcode = $this->languageManager->getCurrentLanguage()->id; + $langcode = $this->languageManager->getCurrentLanguage()->getId(); $this->translation->setDefaultLangcode($langcode); } } only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php @@ -127,7 +127,7 @@ function getLanguageSwitchLinks(Request $request, $type, $path) { $links = array(); $config = $this->config->get('language.negotiation')->get('session'); $param = $config['parameter']; - $language_query = isset($_SESSION[$param]) ? $_SESSION[$param] : $this->languageManager->getCurrentLanguage($type)->id; + $language_query = isset($_SESSION[$param]) ? $_SESSION[$param] : $this->languageManager->getCurrentLanguage($type)->getId(); $query = array(); parse_str($request->getQueryString(), $query); only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUI.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUI.php @@ -32,7 +32,7 @@ class LanguageNegotiationUI extends LanguageNegotiationMethodBase { * {@inheritdoc} */ public function getLangcode(Request $request = NULL) { - return $this->languageManager ? $this->languageManager->getCurrentLanguage()->id : NULL; + return $this->languageManager ? $this->languageManager->getCurrentLanguage()->getId() : NULL; } } only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php @@ -138,12 +138,12 @@ public function processOutbound($path, &$options = array(), Request $request = N } $config = $this->config->get('language.negotiation')->get('url'); if ($config['source'] == LanguageNegotiationUrl::CONFIG_PATH_PREFIX) { - if (is_object($options['language']) && !empty($config['prefixes'][$options['language']->id])) { - return empty($path) ? $config['prefixes'][$options['language']->id] : $config['prefixes'][$options['language']->id] . '/' . $path; + if (is_object($options['language']) && !empty($config['prefixes'][$options['language']->getId()])) { + return empty($path) ? $config['prefixes'][$options['language']->getId()] : $config['prefixes'][$options['language']->getId()] . '/' . $path; } } elseif ($config['source'] == LanguageNegotiationUrl::CONFIG_DOMAIN) { - if (is_object($options['language']) && !empty($config['domains'][$options['language']->id])) { + if (is_object($options['language']) && !empty($config['domains'][$options['language']->getId()])) { // Save the original base URL. If it contains a port, we need to // retain it below. @@ -154,7 +154,7 @@ public function processOutbound($path, &$options = array(), Request $request = N // Ask for an absolute URL with our modified base URL. $options['absolute'] = TRUE; - $options['base_url'] = $url_scheme . '://' . $config['domains'][$options['language']->id]; + $options['base_url'] = $url_scheme . '://' . $config['domains'][$options['language']->getId()]; // In case either the original base URL or the HTTP host contains a // port, retain it. only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrlFallback.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrlFallback.php @@ -62,11 +62,11 @@ public function getLangcode(Request $request = NULL) { // information, a missing URL language information indicates that URL // language should be the default one, otherwise we fall back to an // already detected language. - if (($prefix && empty($config['prefixes'][$default->id])) || (!$prefix && empty($config['domains'][$default->id]))) { - $langcode = $default->id; + if (($prefix && empty($config['prefixes'][$default->getId()])) || (!$prefix && empty($config['domains'][$default->getId()]))) { + $langcode = $default->getId(); } else { - $langcode = $this->languageManager->getCurrentLanguage()->id; + $langcode = $this->languageManager->getCurrentLanguage()->getId(); } } only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php @@ -84,14 +84,14 @@ public function testDefaultLangcode() { language_save_default_configuration('custom_type', 'custom_bundle', array('langcode' => 'current_interface', 'language_show' => TRUE)); $langcode = language_get_default_langcode('custom_type', 'custom_bundle'); $language_interface = \Drupal::languageManager()->getCurrentLanguage(); - $this->assertEqual($langcode, $language_interface->id); + $this->assertEqual($langcode, $language_interface->getId()); // Site's default. $old_default = \Drupal::languageManager()->getDefaultLanguage(); - $old_default->default = FALSE; + $old_default->setDefault(FALSE); language_save($old_default); $new_default = \Drupal::languageManager()->getLanguage('cc'); - $new_default->default = TRUE; + $new_default->setDefault(TRUE); language_save($new_default); language_save_default_configuration('custom_type', 'custom_bundle', array('langcode' => 'site_default', 'language_show' => TRUE)); $langcode = language_get_default_langcode('custom_type', 'custom_bundle'); only in patch2: unchanged: --- a/core/modules/language/lib/Drupal/language/Tests/LanguageDependencyInjectionTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageDependencyInjectionTest.php @@ -62,7 +62,7 @@ function testDependencyInjectedNewDefaultLanguage() { // The language system creates a Language object which contains the // same properties as the new default language object. $result = \Drupal::languageManager()->getCurrentLanguage(); - $this->assertIdentical($result->id, 'fr'); + $this->assertIdentical($result->getId(), 'fr'); // Delete the language to check that we fallback to the default. try { @@ -77,7 +77,7 @@ function testDependencyInjectedNewDefaultLanguage() { language_save($default_language); language_delete('fr'); $result = \Drupal::languageManager()->getCurrentLanguage(); - $this->assertIdentical($result->id, $default_language->id); + $this->assertIdentical($result->getId(), $default_language->id); } } only in patch2: unchanged: --- a/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php +++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php @@ -171,7 +171,7 @@ protected function translateFilters() { } // Pick the current interface language code for the filter. - $default_langcode = $this->languageManager->getCurrentLanguage()->id; + $default_langcode = $this->languageManager->getCurrentLanguage()->getId(); if (!isset($language_options[$default_langcode])) { $available_langcodes = array_keys($language_options); $default_langcode = array_shift($available_langcodes); only in patch2: unchanged: --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -301,7 +301,7 @@ function locale_get_plural($count, $langcode = NULL) { // individually for each language. $plural_indexes = &drupal_static(__FUNCTION__ . ':plurals', array()); - $langcode = $langcode ? $langcode : $language_interface->id; + $langcode = $langcode ? $langcode : $language_interface->getId(); if (!isset($plural_indexes[$langcode][$count])) { // Retrieve and statically cache the plural formulas for all languages. @@ -588,11 +588,11 @@ function locale_js_translate(array $files = array()) { } // If necessary, rebuild the translation file for the current language. - if (!empty($parsed['refresh:' . $language_interface->id])) { + if (!empty($parsed['refresh:' . $language_interface->getId()])) { // Don't clear the refresh flag on failure, so that another try will // be performed later. if (_locale_rebuild_js()) { - unset($parsed['refresh:' . $language_interface->id]); + unset($parsed['refresh:' . $language_interface->getId()]); } // Store any changes after refresh was attempted. \Drupal::state()->set('system.javascript_parsed', $parsed); @@ -606,9 +606,9 @@ function locale_js_translate(array $files = array()) { // Add the translation JavaScript file to the page. $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: array(); $translation_file = NULL; - if (!empty($files) && !empty($locale_javascripts[$language_interface->id])) { + if (!empty($files) && !empty($locale_javascripts[$language_interface->getId()])) { // Add the translation JavaScript file to the page. - $translation_file = $dir . '/' . $language_interface->id . '_' . $locale_javascripts[$language_interface->id] . '.js'; + $translation_file = $dir . '/' . $language_interface->getId() . '_' . $locale_javascripts[$language_interface->getId()] . '.js'; } return $translation_file; } @@ -626,7 +626,7 @@ function locale_library_alter(array &$library, $name) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); $settings['jquery']['ui']['datepicker'] = array( - 'isRTL' => $language_interface->direction == Language::DIRECTION_RTL, + 'isRTL' => $language_interface->getDirection() == Language::DIRECTION_RTL, 'firstDay' => \Drupal::config('system.date')->get('first_day'), ); $library['js'][] = array( @@ -799,20 +799,22 @@ function locale_system_file_system_settings_submit(&$form, $form_state) { * Implements hook_preprocess_HOOK() for node templates. */ function locale_preprocess_node(&$variables) { - if ($variables['node']->language()->id != Language::LANGCODE_NOT_SPECIFIED) { + /** @var \Drupal\node\NodeInterface $node */ + $node = $variables['node']; + if ($node->language()->getId() != Language::LANGCODE_NOT_SPECIFIED) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); - $node_language = $variables['node']->language(); - if ($node_language->id != $language_interface->id) { + $node_language = $node->language(); + if ($node_language->getId() != $language_interface->getId()) { // If the node language was different from the page language, we should // add markup to identify the language. Otherwise the page language is // inherited. - $variables['attributes']['lang'] = $node_language->id; - if ($node_language->direction != $language_interface->direction) { + $variables['attributes']['lang'] = $node_language->getId(); + if ($node_language->getDirection() != $language_interface->getDirection()) { // If text direction is different form the page's text direction, add // direction information as well. $dir = array('ltr', 'rtl'); - $variables['attributes']['dir'] = $dir[$node_language->direction]; + $variables['attributes']['dir'] = $dir[$node_language->getDirection()]; } } } @@ -1264,7 +1266,7 @@ function _locale_rebuild_js($langcode = NULL) { // Only add strings with a translation to the translations array. $conditions = array( 'type' => 'javascript', - 'language' => $language->id, + 'language' => $language->getId(), 'translated' => TRUE, ); $translations = array(); @@ -1281,8 +1283,8 @@ function _locale_rebuild_js($langcode = NULL) { ); $locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array(); - if (!empty($locale_plurals[$language->id]['formula'])) { - $data['pluralFormula'] = $locale_plurals[$language->id]['formula']; + if (!empty($locale_plurals[$language->getId()]['formula'])) { + $data['pluralFormula'] = $locale_plurals[$language->getId()]['formula']; } $data = 'Drupal.locale = ' . Json::encode($data) . ';'; @@ -1295,23 +1297,23 @@ function _locale_rebuild_js($langcode = NULL) { // Delete old file, if we have no translations anymore, or a different file to be saved. $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: array(); - $changed_hash = !isset($locale_javascripts[$language->id]) || ($locale_javascripts[$language->id] != $data_hash); - if (!empty($locale_javascripts[$language->id]) && (!$data || $changed_hash)) { - file_unmanaged_delete($dir . '/' . $language->id . '_' . $locale_javascripts[$language->id] . '.js'); - $locale_javascripts[$language->id] = ''; + $changed_hash = !isset($locale_javascripts[$language->getId()]) || ($locale_javascripts[$language->getId()] != $data_hash); + if (!empty($locale_javascripts[$language->getId()]) && (!$data || $changed_hash)) { + file_unmanaged_delete($dir . '/' . $language->getId() . '_' . $locale_javascripts[$language->getId()] . '.js'); + $locale_javascripts[$language->getId()] = ''; $status = 'deleted'; } // Only create a new file if the content has changed or the original file got // lost. - $dest = $dir . '/' . $language->id . '_' . $data_hash . '.js'; + $dest = $dir . '/' . $language->getId() . '_' . $data_hash . '.js'; if ($data && ($changed_hash || !file_exists($dest))) { // Ensure that the directory exists and is writable, if possible. file_prepare_directory($dir, FILE_CREATE_DIRECTORY); // Save the file. if (file_unmanaged_save_data($data, $dest)) { - $locale_javascripts[$language->id] = $data_hash; + $locale_javascripts[$language->getId()] = $data_hash; // If we deleted a previous version of the file and we replace it with a // new one we have an update. if ($status == 'deleted') { @@ -1329,7 +1331,7 @@ function _locale_rebuild_js($langcode = NULL) { } } else { - $locale_javascripts[$language->id] = ''; + $locale_javascripts[$language->getId()] = ''; $status = 'error'; } } @@ -1344,21 +1346,21 @@ function _locale_rebuild_js($langcode = NULL) { // Log the operation and return success flag. switch ($status) { case 'updated': - watchdog('locale', 'Updated JavaScript translation file for the language %language.', array('%language' => $language->name)); + watchdog('locale', 'Updated JavaScript translation file for the language %language.', array('%language' => $language->getName())); return TRUE; case 'rebuilt': - watchdog('locale', 'JavaScript translation file %file.js was lost.', array('%file' => $locale_javascripts[$language->id]), WATCHDOG_WARNING); + watchdog('locale', 'JavaScript translation file %file.js was lost.', array('%file' => $locale_javascripts[$language->getId()]), WATCHDOG_WARNING); // Proceed to the 'created' case as the JavaScript translation file has // been created again. case 'created': - watchdog('locale', 'Created JavaScript translation file for the language %language.', array('%language' => $language->name)); + watchdog('locale', 'Created JavaScript translation file for the language %language.', array('%language' => $language->getName())); return TRUE; case 'deleted': - watchdog('locale', 'Removed JavaScript translation file for the language %language because no translations currently exist for that language.', array('%language' => $language->name)); + watchdog('locale', 'Removed JavaScript translation file for the language %language because no translations currently exist for that language.', array('%language' => $language->getName())); return TRUE; case 'error': - watchdog('locale', 'An error occurred during creation of the JavaScript translation file for the language %language.', array('%language' => $language->name), WATCHDOG_ERROR); + watchdog('locale', 'An error occurred during creation of the JavaScript translation file for the language %language.', array('%language' => $language->getName()), WATCHDOG_ERROR); return FALSE; default: // No operation needed. only in patch2: unchanged: --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuTree.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuTree.php @@ -155,7 +155,7 @@ public function buildAllData($menu_name, $link = NULL, $max_depth = NULL) { $mlid = isset($link['mlid']) ? $link['mlid'] : 0; // Generate a cache ID (cid) specific for this $menu_name, $link, $language, // and depth. - $cid = 'links:' . $menu_name . ':all:' . $mlid . ':' . $language_interface->id . ':' . (int) $max_depth; + $cid = 'links:' . $menu_name . ':all:' . $mlid . ':' . $language_interface->getId() . ':' . (int) $max_depth; if (!isset($this->menuFullTrees[$cid])) { // If the static variable doesn't have the data, check {cache_menu}. @@ -218,7 +218,7 @@ public function buildPageData($menu_name, $max_depth = NULL, $only_active_trail $max_depth = min($max_depth, MENU_MAX_DEPTH); } // Generate a cache ID (cid) specific for this page. - $cid = 'links:' . $menu_name . ':page:' . $system_path . ':' . $language_interface->id . ':' . $page_not_403 . ':' . (int) $max_depth; + $cid = 'links:' . $menu_name . ':page:' . $system_path . ':' . $language_interface->getId() . ':' . $page_not_403 . ':' . (int) $max_depth; // If we are asked for the active trail only, and $menu_name has not been // built and cached for this page yet, then this likely means that it // won't be built anymore, as this function is invoked from @@ -455,7 +455,7 @@ protected function doBuildTree($menu_name, array $parameters = array()) { if (isset($parameters['expanded'])) { sort($parameters['expanded']); } - $tree_cid = 'links:' . $menu_name . ':tree-data:' . $language_interface->id . ':' . hash('sha256', serialize($parameters)); + $tree_cid = 'links:' . $menu_name . ':tree-data:' . $language_interface->getId() . ':' . hash('sha256', serialize($parameters)); // If we do not have this tree in the static cache, check {cache_menu}. if (!isset($this->menuTree[$tree_cid])) { only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Controller/NodeController.php +++ b/core/modules/node/lib/Drupal/node/Controller/NodeController.php @@ -69,7 +69,7 @@ public function add(NodeTypeInterface $node_type) { 'uid' => $account->id(), 'name' => $account->getUsername() ?: '', 'type' => $node_type->type, - 'langcode' => $langcode ? $langcode : $this->languageManager()->getCurrentLanguage()->id, + 'langcode' => $langcode ? $langcode : $this->languageManager()->getCurrentLanguage()->getId(), )); $form = $this->entityFormBuilder()->getForm($node); only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Entity/Node.php @@ -176,7 +176,7 @@ public function prepareLangcode() { // Load languages the node exists in. $node_translations = $this->getTranslationLanguages(); // Load the language from content negotiation. - $content_negotiation_langcode = \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->id; + $content_negotiation_langcode = \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->getId(); // If there is a translation available, use it. if (isset($node_translations[$content_negotiation_langcode])) { $langcode = $content_negotiation_langcode; only in patch2: unchanged: --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -318,7 +318,7 @@ function node_type_get_types() { * An array of node type labels, keyed by the node type name. */ function node_type_get_names() { - $cid = 'node_type:names:' . \Drupal::languageManager()->getCurrentLanguage()->id; + $cid = 'node_type:names:' . \Drupal::languageManager()->getCurrentLanguage()->getId(); if ($cache = \Drupal::cache()->get($cid)) { return $cache->data; } @@ -1173,7 +1173,7 @@ function node_feed($nids = FALSE, $channel = array()) { 'title' => \Drupal::config('system.site')->get('name'), 'link' => $base_url, 'description' => $rss_config->get('channel.description'), - 'language' => $language_content->id + 'language' => $language_content->getId() ); $channel_extras = array_diff_key($channel, $channel_defaults); $channel = array_merge($channel_defaults, $channel); only in patch2: unchanged: --- a/core/modules/search/search.pages.inc +++ b/core/modules/search/search.pages.inc @@ -36,7 +36,7 @@ function template_preprocess_search_result(&$variables) { $result = $variables['result']; $variables['url'] = check_url($result['link']); $variables['title'] = check_plain($result['title']); - if (isset($result['language']) && $result['language'] != $language_interface->id && $result['language'] != Language::LANGCODE_NOT_SPECIFIED) { + if (isset($result['language']) && $result['language'] != $language_interface->getId() && $result['language'] != Language::LANGCODE_NOT_SPECIFIED) { $variables['title_attributes']['lang'] = $result['language']; $variables['content_attributes']['lang'] = $result['language']; } only in patch2: unchanged: --- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php @@ -56,7 +56,7 @@ function testStatisticsTokenReplacement() { $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); foreach ($tests as $input => $expected) { - $output = \Drupal::token()->replace($input, array('node' => $node), array('langcode' => $language_interface->id)); + $output = \Drupal::token()->replace($input, array('node' => $node), array('langcode' => $language_interface->getId())); $this->assertEqual($output, $expected, format_string('Statistics token %token replaced.', array('%token' => $input))); } } only in patch2: unchanged: --- a/core/modules/system/core.api.php +++ b/core/modules/system/core.api.php @@ -201,7 +201,7 @@ * * Example: * @code - * $cid = 'mymodule_example:' . \Drupal::languageManager()->getCurrentLanguage()->id(); + * $cid = 'mymodule_example:' . \Drupal::languageManager()->getCurrentLanguage()->getId(); * * $data = NULL; * if ($cache = \Drupal::cache()->get($cid)) { only in patch2: unchanged: --- a/core/modules/system/language.api.php +++ b/core/modules/system/language.api.php @@ -28,7 +28,7 @@ function hook_language_switch_links_alter(array &$links, $type, $path) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); if ($type == \Drupal\Core\Language\Language::TYPE_CONTENT && isset($links[$language_interface->id])) { - foreach ($links[$language_interface->id] as $link) { + foreach ($links[$language_interface->getId()] as $link) { $link['attributes']['class'][] = 'active-language'; } } only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php @@ -132,8 +132,8 @@ function testFormatDate() { // Save the original user and language and then replace it with the test user and language. $real_user = $user; $user = user_load($test_user->id(), TRUE); - $real_language = $language_interface->id; - $language_interface->id = $user->getPreferredLangcode(); + $real_language = $language_interface->getId(); + $language_interface->setId($user->getPreferredLangcode()); // Simulate a Drupal bootstrap with the logged-in user. date_default_timezone_set(drupal_get_user_timezone()); @@ -155,7 +155,7 @@ function testFormatDate() { // Restore the original user and language, and enable session saving. $user = $real_user; - $language_interface->id = $real_language; + $language_interface->setId($real_language); // Restore default time zone. date_default_timezone_set(drupal_get_user_timezone()); drupal_save_session(TRUE); only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php @@ -156,9 +156,9 @@ function testMaintenancePage() { // HTML element attributes. $html_attributes = new Attribute; - $language_interface = \Drupal::service('language_manager')->getCurrentLanguage(); - $html_attributes['lang'] = $language_interface->id; - $html_attributes['dir'] = $language_interface->direction ? 'rtl' : 'ltr'; + $language_interface = \Drupal::languageManager()->getCurrentLanguage(); + $html_attributes['lang'] = $language_interface->getId(); + $html_attributes['dir'] = $language_interface->getDirection() ? 'rtl' : 'ltr'; $site_config = \Drupal::config('system.site'); only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php @@ -448,7 +448,7 @@ function testEntityTranslationAPI() { * Tests language fallback applied to field and entity translations. */ function testLanguageFallback() { - $current_langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->id; + $current_langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->getId(); $this->langcodes[] = $current_langcode; $values = array(); only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Mail/MailTest.php @@ -67,7 +67,7 @@ public function testCancelMessage() { \Drupal::state()->set('system.test_mail_collector', array()); // Send a test message that simpletest_mail_alter should cancel. - drupal_mail('simpletest', 'cancel_test', 'cancel@example.com', $language_interface->id); + drupal_mail('simpletest', 'cancel_test', 'cancel@example.com', $language_interface->getId()); // Retrieve sent message. $captured_emails = \Drupal::state()->get('system.test_mail_collector'); $sent_message = end($captured_emails); only in patch2: unchanged: --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -327,7 +327,7 @@ function hook_library_alter(array &$library, $name) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); $settings['jquery']['ui']['datepicker'] = array( - 'isRTL' => $language_interface->direction == Language::DIRECTION_RTL, + 'isRTL' => $language_interface->getDirection() == Language::DIRECTION_RTL, 'firstDay' => \Drupal::config('system.date')->get('first_day'), ); $library['js'][] = array( @@ -1285,7 +1285,7 @@ function hook_watchdog(array $log_entry) { '@message' => strip_tags($log_entry['message']), )); - drupal_mail('emaillog', 'entry', $to, $language_interface->id, $params); + drupal_mail('emaillog', 'entry', $to, $language_interface->getId(), $params); } /** only in patch2: unchanged: --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -967,7 +967,7 @@ function system_page_build(&$page) { array( 'path' => current_path(), 'front' => drupal_is_front_page(), - 'language' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\Language::TYPE_URL)->id, + 'language' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\Language::TYPE_URL)->getId(), 'query' => \Drupal::service('request')->query->all(), ) ); only in patch2: unchanged: --- a/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php +++ b/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/CachedMockBlockManager.php @@ -25,6 +25,6 @@ public function __construct() { // The CacheDecorator allows us to cache these plugin definitions for // quicker retrieval. In this case we are generating a cache key by // language. - $this->discovery = new CacheDecorator($this->discovery, 'mock_block:' . \Drupal::languageManager()->getCurrentLanguage()->id, 'default', 1542646800, array('plugin_test')); + $this->discovery = new CacheDecorator($this->discovery, 'mock_block:' . \Drupal::languageManager()->getCurrentLanguage()->getId(), 'default', 1542646800, array('plugin_test')); } } only in patch2: unchanged: --- a/core/modules/system/theme.api.php +++ b/core/modules/system/theme.api.php @@ -288,7 +288,7 @@ function hook_theme_suggestions_HOOK(array $variables) { */ function hook_theme_suggestions_alter(array &$suggestions, array $variables, $hook) { // Add an interface-language specific suggestion to all theme hooks. - $suggestions[] = $hook . '__' . \Drupal::languageManager()->getCurrentLanguage()->id; + $suggestions[] = $hook . '__' . \Drupal::languageManager()->getCurrentLanguage()->getId(); } /** only in patch2: unchanged: --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php @@ -97,7 +97,7 @@ function testTaxonomyTokenReplacement() { $tests['[term:vocabulary:name]'] = String::checkPlain($this->vocabulary->name); foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('term' => $term1), array('langcode' => $language_interface->id)); + $output = $token_service->replace($input, array('term' => $term1), array('langcode' => $language_interface->getId())); $this->assertEqual($output, $expected, format_string('Sanitized taxonomy term token %token replaced.', array('%token' => $input))); } @@ -117,7 +117,7 @@ function testTaxonomyTokenReplacement() { $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('term' => $term2), array('langcode' => $language_interface->id)); + $output = $token_service->replace($input, array('term' => $term2), array('langcode' => $language_interface->getId())); $this->assertEqual($output, $expected, format_string('Sanitized taxonomy term token %token replaced.', array('%token' => $input))); } @@ -128,7 +128,7 @@ function testTaxonomyTokenReplacement() { $tests['[term:vocabulary:name]'] = $this->vocabulary->name; foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('term' => $term2), array('langcode' => $language_interface->id, 'sanitize' => FALSE)); + $output = $token_service->replace($input, array('term' => $term2), array('langcode' => $language_interface->getId(), 'sanitize' => FALSE)); $this->assertEqual($output, $expected, format_string('Unsanitized taxonomy term token %token replaced.', array('%token' => $input))); } @@ -144,7 +144,7 @@ function testTaxonomyTokenReplacement() { $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('vocabulary' => $this->vocabulary), array('langcode' => $language_interface->id)); + $output = $token_service->replace($input, array('vocabulary' => $this->vocabulary), array('langcode' => $language_interface->getId())); $this->assertEqual($output, $expected, format_string('Sanitized taxonomy vocabulary token %token replaced.', array('%token' => $input))); } @@ -153,7 +153,7 @@ function testTaxonomyTokenReplacement() { $tests['[vocabulary:description]'] = $this->vocabulary->description; foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('vocabulary' => $this->vocabulary), array('langcode' => $language_interface->id, 'sanitize' => FALSE)); + $output = $token_service->replace($input, array('vocabulary' => $this->vocabulary), array('langcode' => $language_interface->getId(), 'sanitize' => FALSE)); $this->assertEqual($output, $expected, format_string('Unsanitized taxonomy vocabulary token %token replaced.', array('%token' => $input))); } } only in patch2: unchanged: --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -378,7 +378,7 @@ function toolbar_toolbar() { // toolbar_subtrees route. We provide the JavaScript requesting that JSONP // script here with the hash parameter that is needed for that route. // @see toolbar_subtrees_jsonp() - $langcode = \Drupal::languageManager()->getCurrentLanguage()->id; + $langcode = \Drupal::languageManager()->getCurrentLanguage()->getId(); $menu['toolbar_administration']['#attached']['js'][] = array( 'type' => 'setting', 'data' => array('toolbar' => array( only in patch2: unchanged: --- a/core/modules/user/lib/Drupal/user/AccountFormController.php +++ b/core/modules/user/lib/Drupal/user/AccountFormController.php @@ -233,9 +233,9 @@ public function form(array $form, array &$form_state) { ); } - $user_preferred_langcode = $register ? $language_interface->id : $account->getPreferredLangcode(); + $user_preferred_langcode = $register ? $language_interface->getId() : $account->getPreferredLangcode(); - $user_preferred_admin_langcode = $register ? $language_interface->id : $account->getPreferredAdminLangcode(); + $user_preferred_admin_langcode = $register ? $language_interface->getId() : $account->getPreferredAdminLangcode(); // Is the user preferred language enabled? $user_language_enabled = FALSE; only in patch2: unchanged: --- a/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php +++ b/core/modules/user/lib/Drupal/user/Form/UserPasswordForm.php @@ -128,7 +128,7 @@ public function validateForm(array &$form, array &$form_state) { * {@inheritdoc} */ public function submitForm(array &$form, array &$form_state) { - $langcode = $this->languageManager->getCurrentLanguage()->id; + $langcode = $this->languageManager->getCurrentLanguage()->getId(); $account = $form_state['values']['account']; // Mail one time login URL and instructions using current language. only in patch2: unchanged: --- a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php @@ -66,17 +66,17 @@ function testUserTokenReplacement() { $tests['[user:mail]'] = check_plain($account->getEmail()); $tests['[user:url]'] = url("user/" . $account->id(), $url_options); $tests['[user:edit-url]'] = url("user/" . $account->id() . "/edit", $url_options); - $tests['[user:last-login]'] = format_date($account->getLastLoginTime(), 'medium', '', NULL, $language_interface->id); - $tests['[user:last-login:short]'] = format_date($account->getLastLoginTime(), 'short', '', NULL, $language_interface->id); - $tests['[user:created]'] = format_date($account->getCreatedTime(), 'medium', '', NULL, $language_interface->id); - $tests['[user:created:short]'] = format_date($account->getCreatedTime(), 'short', '', NULL, $language_interface->id); + $tests['[user:last-login]'] = format_date($account->getLastLoginTime(), 'medium', '', NULL, $language_interface->getId()); + $tests['[user:last-login:short]'] = format_date($account->getLastLoginTime(), 'short', '', NULL, $language_interface->getId()); + $tests['[user:created]'] = format_date($account->getCreatedTime(), 'medium', '', NULL, $language_interface->getId()); + $tests['[user:created:short]'] = format_date($account->getCreatedTime(), 'short', '', NULL, $language_interface->getId()); $tests['[current-user:name]'] = check_plain(user_format_name($global_account)); // Test to make sure that we generated something for each token. $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('user' => $account), array('langcode' => $language_interface->id)); + $output = $token_service->replace($input, array('user' => $account), array('langcode' => $language_interface->getId())); $this->assertEqual($output, $expected, format_string('Sanitized user token %token replaced.', array('%token' => $input))); } @@ -86,7 +86,7 @@ function testUserTokenReplacement() { $tests['[current-user:name]'] = user_format_name($global_account); foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('user' => $account), array('langcode' => $language_interface->id, 'sanitize' => FALSE)); + $output = $token_service->replace($input, array('user' => $account), array('langcode' => $language_interface->getId(), 'sanitize' => FALSE)); $this->assertEqual($output, $expected, format_string('Unsanitized user token %token replaced.', array('%token' => $input))); } @@ -98,7 +98,7 @@ function testUserTokenReplacement() { // Generate tokens with interface language. $link = url('user', array('absolute' => TRUE)); foreach ($tests as $input => $expected) { - $output = $token_service->replace($input, array('user' => $account), array('langcode' => $language_interface->id, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE)); + $output = $token_service->replace($input, array('user' => $account), array('langcode' => $language_interface->getId(), 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE)); $this->assertTrue(strpos($output, $link) === 0, 'Generated URL is in interface language.'); } only in patch2: unchanged: --- a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php @@ -294,7 +294,7 @@ public function generateResultsKey() { 'build_info' => $build_info, 'roles' => $user->getRoles(), 'super-user' => $user->id() == 1, // special caching for super user. - 'langcode' => \Drupal::languageManager()->getCurrentLanguage()->id, + 'langcode' => \Drupal::languageManager()->getCurrentLanguage()->getId(), 'base_url' => $GLOBALS['base_url'], ); $request = \Drupal::request(); @@ -324,7 +324,7 @@ public function generateOutputKey() { 'roles' => $user->getRoles(), 'super-user' => $user->id() == 1, // special caching for super user. 'theme' => $GLOBALS['theme'], - 'langcode' => \Drupal::languageManager()->getCurrentLanguage()->id, + 'langcode' => \Drupal::languageManager()->getCurrentLanguage()->getId(), 'base_url' => $GLOBALS['base_url'], ); only in patch2: unchanged: --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -157,7 +157,7 @@ public function initDisplay(ViewExecutable $view, array &$display, array &$optio $skip_cache = \Drupal::config('views.settings')->get('skip_cache'); if (empty($view->editing) || !$skip_cache) { - $cid = 'views:unpack_options:' . hash('sha256', serialize(array($this->options, $options))) . ':' . \Drupal::languageManager()->getCurrentLanguage()->id; + $cid = 'views:unpack_options:' . hash('sha256', serialize(array($this->options, $options))) . ':' . \Drupal::languageManager()->getCurrentLanguage()->getId(); if (empty(static::$unpackOptions[$cid])) { $cache = \Drupal::cache('data')->get($cid); if (!empty($cache->data)) { only in patch2: unchanged: --- a/core/modules/views/lib/Drupal/views/ViewsData.php +++ b/core/modules/views/lib/Drupal/views/ViewsData.php @@ -96,7 +96,7 @@ public function __construct(CacheBackendInterface $cache_backend, ConfigFactoryI $this->moduleHandler = $module_handler; $this->languageManager = $language_manager; - $this->langcode = $this->languageManager->getCurrentLanguage()->id; + $this->langcode = $this->languageManager->getCurrentLanguage()->getId(); $this->skipCache = $config->get('views.settings')->get('skip_cache'); } only in patch2: unchanged: --- a/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -341,8 +341,8 @@ function hook_views_query_substitutions(ViewExecutable $view) { return array( '***CURRENT_VERSION***' => \Drupal::VERSION, '***CURRENT_TIME***' => REQUEST_TIME, - '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\Language::TYPE_CONTENT)->id, - '***DEFAULT_LANGUAGE***' => \Drupal::languageManager()->getDefaultLanguage()->id, + '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\Language::TYPE_CONTENT)->getId(), + '***DEFAULT_LANGUAGE***' => \Drupal::languageManager()->getDefaultLanguage()->getId(), ); } only in patch2: unchanged: --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -995,7 +995,7 @@ function template_preprocess_views_view_rss(&$variables) { $variables['link'] = check_url(url($path, $url_options)); } - $variables['langcode'] = String::checkPlain(\Drupal::languageManager()->getCurrentLanguage()->id); + $variables['langcode'] = String::checkPlain(\Drupal::languageManager()->getCurrentLanguage()->getId()); $variables['namespaces'] = new Attribute($style->namespaces); $variables['items'] = $items; $variables['channel_elements'] = format_xml_elements($style->channel_elements); only in patch2: unchanged: --- a/core/modules/views/views.views_execution.inc +++ b/core/modules/views/views.views_execution.inc @@ -17,7 +17,7 @@ function views_views_query_substitutions(ViewExecutable $view) { return array( '***CURRENT_VERSION***' => \Drupal::VERSION, '***CURRENT_TIME***' => REQUEST_TIME, - '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->id, - '***DEFAULT_LANGUAGE***' => \Drupal::languageManager()->getDefaultLanguage()->id, + '***CURRENT_LANGUAGE***' => \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->getId(), + '***DEFAULT_LANGUAGE***' => \Drupal::languageManager()->getDefaultLanguage()->getId(), ); }