Details
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...