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

Prefered language detection from browser setting does not take into account the country

    XMLWordPrintable

Details

    • Bug
    • Resolution: Solved By
    • Major
    • None
    • 5.4.1
    • Old Core
    • Unknown

    Description

      Currently, if the browser provides in its accepted-languages header something like pt-BR, the language set in the context (and the cookie) is pt. This is definitely wrong, since we support pt_BR and pt translations separately.

      If we simply fix the browser detection to report fr_FR, and the supported language only contains en,fr with a default to en, we will need to also take care of falling back to fr. Currently, the browser detected language is only forced to be a supported language if xwiki.language.forceSupported' is configured to 1 (the default being 0), and obviously does not take care of these countries subtleties.

      Apart from com.xpn.xwiki.XWiki#getLanguagePreference(), com.xpn.xwiki.XWiki#getDocLanguagePreferenceNew() and com.xpn.xwiki.XWiki#getInterfaceLanguagePreference() use their own parsing that does not support the country either.

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              softec Denis Gervalle
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: