Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-15991

Wrong locale used in multilingual wiki



    • Bug
    • Resolution: Fixed
    • Major
    • 11.2-rc-1
    • 9.11.8, 10.10
    • Localization
    • None
    • Unit
    • Unknown
    • Pull Request accepted


      Steps to reproduce

      1. Login as an Admin
      2. Set the wiki as multilingual
      3. Remove the English language and add French instead (both default and supported)
      4. Create a new document in French (e.g. Sandbox.TestLang) and set this as the content:
        Locale: $xcontext.locale
      5. Go to the document and set the URL parameter language to en (e.g. http://localhost:8080/xwiki/bin/view/Sandbox/TestLang/?language=en)
      6. 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):

      1. Use the locale specified in the URL parameter language only if it is in the supported languages
      2. Use the locale specified in the user cookie only if it is in the supported languages
      3. Use the best supported locale given by the Accept-Language request header sent by the user's browser
      4. Use the default wiki language


        Issue Links



              surli Simon Urli
              atallahade Adel Atallah
              0 Vote for this issue
              2 Start watching this issue