Problem

When enabled Content language detection (Determines the content language from a request parameter.) option, the language switcher links not working properly.

Steps to reproduce

Steps to reproduce
On a fresh D9 install:

  1. Enable 'Content translation' and language modules
  2. Add another language
  3. Under Detection and selection (/admin/config/regional/language/detection) configuration, enable 'Customize Content language detection to differ from Interface text language detection settings' option and enable 'Content language' checkbox.
  4. Set domains under 'URL language detection configuration' instead of 'Path prefix'
  5. Enable language settings for 'Basic Page' content type under 'Content language' settings (/admin/config/regional/content-language)
  6. Assign 'Language Switcher' block in to a region.
  7. Create a 'Basic Page' content and add the translations.
  8. Try to switch translation for the content that created in the previous step using language switcher block.

Language Detection
Language Detection URL Settings

Comments

ARUN AK created an issue. See original summary.

kristen pol’s picture

Version: 9.1.x-dev » 9.2.x-dev
Issue tags: +Bug Smash Initiative

Needs to be reproduced on 9.2.

kristen pol’s picture

I don't have my normal dev environment set up but, for comparison, I'm including what I tested using *path prefix* URL detection instead of *domain* URL detection:

  1. I'm using the Umami profile so translation modules, languages, and content types are already configured
  2. Updated the "Detection and selection" settings to match the screenshots above except keeping URL path prefix setting
  3. Created English node (/node/19) and "translated" into Spanish
  4. Went to /node/19 to get rid of any path prefix
  5. See English version of node as expected since English is my default language
  6. Language switcher has /en/node/19?language_content_entity=en for English and /en/node/19?language_content_entity=es for Spanish
  7. After clicking on Spanish in language switcher, the Spanish node content is shown
  8. This is because language_content_entity is in the URL, so the content is based on that
  9. Language switcher has /en/node/19?language_content_entity=es for both English and Spanish
  10. Toggling between English and Spanish in the language switcher doesn't change the node content
  11. Manually changing the language_content_entity query parameter to en makes the English content show
  12. Language switcher has /en/node/19?language_content_entity=en for both English and Spanish
  13. Manually changing the path prefix to es doesn't affect the English node content because detection is using the query param
  14. Language switcher has /es/node/19?language_content_entity=en for both English and Spanish

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

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

anybody’s picture

Looks like this needs a reals META plan issue ;)

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

geek-merlin’s picture

Title: Language switcher not working properly when When content language detection is different from interface language detection with domain option for URL language detection configuration » Language switcher not working properly when content language detection is different from interface language detection

I can confirm that whether domain or path based urls does not matter.

geek-merlin’s picture

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.