* @return Mixed: variant if one found, false otherwise.
*/
protected function getUserVariant() {
- global $wgUser;
+ global $wgUser, $wgContLang;
// memoizing this function wreaks havoc on parserTest.php
/*
// Don't call this on stub objects because that causes infinite
// recursion during initialisation
if ( $wgUser->isLoggedIn() ) {
- $ret = $wgUser->getOption( 'variant' );
+ if ( $this->mMainLanguageCode == $wgContLang->getCode() ) {
+ $ret = $wgUser->getOption( 'variant' );
+ } else {
+ $ret = $wgUser->getOption( 'variant-' . $this->mMainLanguageCode );
+ }
} else {
// figure out user lang without constructing wgLang to avoid
// infinite recursion