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

User's default language is no longer taken into account

    Details

    • Difficulty:
      Unknown
    • Similar issues:

      Description

      If you set the "default_language" xproperty for a user, it's not taken into account any more when resolving the locale to use (see algo on https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Configuration/#HAlgorithm).

      The issue is that the context user is only set when XWiki#prepareDocs() is called in XWikiAction (this internally calls checkAccess which authenticate the user which puts the user in the context). When XWiki#getLocalePreferences() is called, the user has not been authenticated yet and thus it's not in the context.

      This is because getLocalePreferences() is called very early: it's called at the beginning of prepareDocs() (through the call to prepareResources()) before checkAccess() is called.

      And once the locale is set in the context, it's not computed again. Thus the default_language for the guest user (ie not defined) is always used...

        Attachments

          Activity

            People

            • Assignee:
              vmassol Vincent Massol
              Reporter:
              vmassol Vincent Massol
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: