Hi,

when using "Content" language negotiation, I would expect to be able to change (as far as possible) the content language and interface language independently one form the other, but there are still some issues that prevent that, see the meta-issue #2860901: Doubts about Content language negotiation.

One of the things I noticed is that LanguageNegotiationContentEntity::processOutbound() operates only when these conditions are met:

  1. URL points to an entity;
  2. AND it refers to the current request.

The result of this is that on non-entity pages, like for instance the front page, a link to an entity would change the interface language because the query string to change the content language is missing.

Look at the image:
content language negotiation processOutboud changes interface language

This could be fixed by relaxing the conditions from above in LanguageNegotiationContentEntity::meetsContentEntityRoutesCondition().

A tentative patch is on its way.

Thanks,
Antonio

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ao2 created an issue. See original summary.

ao2’s picture

Status: Needs review » Needs work
ao2’s picture

Uploaded a new patch, the previous one was made against drupal-core and failed to apply because the file paths in the diff header were off (missing core/ subdir in the paths).

ao2’s picture

Updated patch, changes since the previous version:

  • Don't remove the getContentEntityTypeIdForCurrentRequest() method, it will be useful in another fix I am working on.

Thanks,
Antonio

Status: Needs review » Needs work
ao2’s picture

ao2’s picture

Adjusting the tests to consider the new behavior when the current request is not an entity route.

penyaskito’s picture

Status: Needs review » Needs work
+++ b/core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php
@@ -78,10 +78,6 @@ class EntityUrlLanguageTest extends LanguageTestBase {
-    // Without being on an content entity route the default entity URL tests
-    // should still pass.
-    $this->testEntityUrlLanguage();
-

I didn't look in detail to the patch, but modifying this test removing assertions doesn't look right to me unless there is a justified reason.

Could we add another test for the use case we are covering here? That will make the issue more understandable and without introducing any regressions.

ao2’s picture

@penyaskito I can add a test, sure, but I'd like to know first if the problem itself is recognized as valid.
Are the images above clear enough?

Thanks,
Antonio

plach’s picture

Status: Needs work » Postponed (maintainer needs more info)

I was not able to replicate this, see #2860901-13: Doubts about Content language negotiation: can you double check on the latest HEAD and post the exact steps to reproduce it on a fresh installation? Ideally even a DB dump along with the commit hash, if it's a test site.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
quietone’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
Issue tags: +Bug Smash Initiative

@ao2, Thank you for reporting this problem. We rely on issue reports like this one to resolve bugs and improve Drupal core.

There has been no activity here for 5 years.

More information about this issue was asked for in #11, 5 years ago, when plach reported they could not reproduce the problem. No additional information has been supplied, therefor closing.

If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").

Thanks!