From a6d845f5c2e969d17b40777c54aaf067f4bd7541 Mon Sep 17 00:00:00 2001 From: Liangent Date: Fri, 24 Aug 2012 03:21:01 +0800 Subject: [PATCH] Check fallbacks correctly in getHeaderVariant(). Currently when users with Accept-Language: en accesses a zh site, getVariantFallbacks() returns zh for it and zh is treated as their preferred variant as header variant, making the configuration setting $wgDefaultLanguageVariant ignored. Per comments above getVariantFallbacks(), it returns the main language code for an unknown variant (en in this case), so when it's returning the main code, just ignore this fallback (when the user is really sending Accept-Language: zh, it can be caught by validateVariant() above and fallbacks are not consulted). Change-Id: I187bdcd70b778883cc80ceeab005de3aca2e286a --- languages/LanguageConverter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index cbd5d9ae9d..8b7d6cbec0 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -295,7 +295,7 @@ class LanguageConverter { // We record these fallback variants, and process // them later. $fallbacks = $this->getVariantFallbacks( $language ); - if ( is_string( $fallbacks ) ) { + if ( is_string( $fallbacks ) && $fallbacks !== $this->mMainLanguageCode ) { $fallbackLanguages[] = $fallbacks; } elseif ( is_array( $fallbacks ) ) { $fallbackLanguages = -- 2.20.1