Details
-
Bug
-
Resolution: Fixed
-
Major
-
9.11.8, 10.10
-
None
Description
Steps to reproduce
- Login as an Admin
- Set the wiki as multilingual
- Remove the English language and add French instead (both default and supported)
- Create a new document in French (e.g. Sandbox.TestLang) and set this as the content:
{{velocity}} Locale: $xcontext.locale {{/velocity}}
- Go to the document and set the URL parameter language to en (e.g. http://localhost:8080/xwiki/bin/view/Sandbox/TestLang/?language=en)
- Go to the document with a browser that accepts english (with a higher priority) and french languages. (do it without any cookies and logged out, with private browsing for instance)
Expected result
You should see "Locale: fr" in the document content in both cases.
Actual result
"Locale: en" is shown
Possible solution
To fix the issue, I propose the following rules to determine the user locale (the one that we find in the context):
- Use the locale specified in the URL parameter language only if it is in the supported languages
- Use the locale specified in the user cookie only if it is in the supported languages
- Use the best supported locale given by the Accept-Language request header sent by the user's browser
- Use the default wiki language
Attachments
Issue Links
- is related to
-
XWIKI-8927 Language cookie is not updated with the Default Language set in XWiki Preferences
- Open
-
XWIKI-14165 Unable to edit the original document if it has default language blank and en (configured default translation) translation exists
- Closed