There are 6 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-12c74920-5465-47e5-be03-9256db12956a XWIKI-8927 Closed

Language cookie is not updated with the Default Language set in XWiki Preferences

 
View issue   ยท   Add comment
 

6 updates

 
cid:jira-generated-image-avatar-b48e7cad-5172-42f5-a61e-dcb0ca9af7d4 Changes by Simon Urli on 19/Nov/26 09:48
 
Documentation in Release Notes: N/A
Documentation: N/A
Assignee: Simon Urli
Resolution: Cannot Reproduce
Status: Open Closed
Labels: bugfixingday
 
 

1 comment

 
cid:jira-generated-image-avatar-b48e7cad-5172-42f5-a61e-dcb0ca9af7d4 Simon Urli on 19/Nov/26 09:48
 

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.