I couldn't reproduce this issue on XWiki 18.9.0, so I'm closing it as Cannot Reproduce.
Setup: official xwiki:18.9.0-postgres-tomcat Docker image, with XWiki.XWikiPreferences set to multilingual=1, languages=fr, default_language=fr. I used a Chromium browser with an English UI (navigator.language = en-US, sending Accept-Language: en-US) and no cookies.
Following the steps of the description:
visiting a page as guest: the page is in French, no language cookie is set
clicking the login link: the login page is in French, still no language cookie
logging in and being redirected back: the page is in French, still no language cookie
The server never sends a Set-Cookie: language header on the view or login pages, and it answers with Content-Language: fr.
This matches the current code of XWiki#getLocalePreference:
The language cookie is only written when the request explicitly contains a language parameter, and ?language=default clears it.
When there is no parameter and no cookie, the browser's Accept-Language locales are only used if they are among the supported languages of the wiki (xwiki.language.forceSupported is enabled by default). Otherwise the wiki default language is used.
Note that on a wiki supporting both fr and en, a browser asking for English gets English. This is the intended resolution order: request parameter, then cookie, then browser, then wiki default. To always use the wiki default language instead of the browser's, set preferDefaultLanguage in the wiki or space preferences, or xwiki.language.preferDefault=1 in xwiki.cfg.
This comment was written by Claude Code (AI assistant) on behalf of Simon Urli, who reviewed it.
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.