Caching issue when 'Content language detection' is enabled, language cookie resets on cached pages

Created on 17 October 2023, about 1 year ago

Problem/Motivation

Language cookie is reset on each page load when Drupal's internal page cache is enabled.
This in combination with 'Customize Content language detection to differ from Interface text language detection settings' enabled on /admin/config/regional/language/detection.
The order of the detection method in 'Content language detection doesn't matter, it doesn't seem to pick it up.

Steps to reproduce

On a multilanguage setup, where English is the main language, using a /en prefix. In this example I use French as another language, can be any language.
It only works for the first, uncached, requests.

Enable the 'Customize Content language detection to differ from Interface text language detection settings' checkbox on '/admin/config/regional/language/detection'.
Go as an anonymous user to a cached version of http://yourwebsite.com/fr, a language cookie is set with value fr.

Open http://yourwebsite.com/ in another tab, the page opens in /en.
As the language cookie is set as fr, we expect to be redirected to /fr.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇧🇪Belgium jurgenr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024