Check headers for default variant when initializing default user options.
authorLiangent <liangent@gmail.com>
Sat, 12 May 2012 15:52:52 +0000 (23:52 +0800)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 10 Oct 2012 04:31:59 +0000 (04:31 +0000)
commite4bae8bca407fdb2c2961fa055ef8a6e867c4aaa
tree33f4b219a214a05132807d53c9c1966cfed84293
parentd4305da200abe8a2b5fd13d6a5ab4e9e08ebdf48
Check headers for default variant when initializing default user options.

Currently, if a user with Accept-Language: zh-tw header accesses a zh site,
the page contents are served in zh-tw variant, but the interface language
is zh (falling back to zh-hans) so the user is seeing interface messages
in zh(-hans) unless a &variant= is manually set (originally variant set in
URL is checked by getDefaultVariant).

There were debates that serving different languages based on headers from
the same URL breaks cache, but currently contents are served in different
variants based on headers and it works. So I assume this is not an issue.

PS2-4: HTTP header settings shouldn't affect user preference settings of
logged-in users.

PS5-6: Move code loading variant settings for anonymous requests from
User::getDefaultOptions() to User::loadOptions() to avoid pollution of
defaults. A visual bug of this is that if I have variant set to zh and
load index.php?title=Special:Preferences&variant=zh-cn, the dropdown is
shown as zh-cn because I was using the default value and now it thinks the
default value is zh-cn instead of zh.

PS7-8: Rebase to add dependency and tweak commit summary etc.

PS9: Remove the argument added to getDefaultVariant, which was intended to
keep B/C of getDefaultVariant (not to check headers by default).

Change-Id: Ie600ab24294a1add804875e921c32febe6ed645f
includes/User.php
languages/LanguageConverter.php