diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 01c51da..2c7eb83 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -492,6 +492,7 @@ function comment_entity_view(EntityInterface $entity, EntityViewDisplayInterface if (user_access('post comments')) { $links['comment-add'] = array( 'title' => t('Add new comment'), + 'language' => $entity->language(), 'attributes' => array('title' => t('Add a new comment to this page.')), 'fragment' => 'comment-form', ); diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php index 62aba31..4466a91 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php @@ -117,14 +117,14 @@ function testPathLanguageConfiguration() { $this->container->get('path.crud')->delete($edit); // Create language nodes to check priority of aliases. - $first_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1)); - $second_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1)); + $first_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1, 'langcode' => 'en')); + $second_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1, 'langcode' => Language::LANGCODE_NOT_SPECIFIED)); // Assign a custom path alias to the first node with the English language. $edit = array( 'source' => 'node/' . $first_node->id(), 'alias' => $custom_path, - 'langcode' => 'en', + 'langcode' => $first_node->language()->id, ); $this->container->get('path.crud')->save($edit['source'], $edit['alias'], $edit['langcode']); @@ -132,7 +132,7 @@ function testPathLanguageConfiguration() { $edit = array( 'source' => 'node/' . $second_node->id(), 'alias' => $custom_path, - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => $second_node->language()->id, ); $this->container->get('path.crud')->save($edit['source'], $edit['alias'], $edit['langcode']); diff --git a/core/modules/node/lib/Drupal/node/NodeViewBuilder.php b/core/modules/node/lib/Drupal/node/NodeViewBuilder.php index 75eb28b..6a0c8a8 100644 --- a/core/modules/node/lib/Drupal/node/NodeViewBuilder.php +++ b/core/modules/node/lib/Drupal/node/NodeViewBuilder.php @@ -118,6 +118,7 @@ protected static function buildLinks(NodeInterface $entity, $view_mode) { '@title' => $node_title_stripped, )), 'href' => 'node/' . $entity->id(), + 'language' => $entity->language(), 'html' => TRUE, 'attributes' => array( 'rel' => 'tag', diff --git a/core/modules/node/node.module b/core/modules/node/node.module index c22abe3..f736159 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -652,7 +652,9 @@ function template_preprocess_node(&$variables) { ); $variables['name'] = drupal_render($username); - $variables['node_url'] = $node->url(); + $variables['node_url'] = $node->url('canonical', array( + 'language' => $node->language(), + )); $variables['label'] = $variables['elements']['title']; unset($variables['elements']['title']); $variables['page'] = $variables['view_mode'] == 'full' && node_is_page($node);