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

The country code specified in the Accept-Language HTTP header is ignored when computing the current locale

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • None
    • 6.4
    • Localization, Old Core
    • None
    • Unknown

    Description

      Follow this steps to reproduce:

      1. Create a new wiki page with this content:
        {{velocity}}
        $services.localization.currentLocale
        {{/velocity}}
        
      2. Configure your browser to ask for Brazilian Portuguese language
      3. Logout
      4. Clear the existing cookies
      5. Access the wiki page created in the first step

      You get 'pt' although we would expect 'pt_BR'.

      You can check the HTTP headers of the request. I got:

      pt-BR,en-US;q=0.7,en;q=0.3
      

      so 'pt-BR' is included as first option.

      The problem comes from XWiki.getAcceptedLanguages() which keeps only the language code (ignoring the country code).

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: