Allow $wgULSLanguageDetection to work if $wgULSAnonCanChangeLanguage is false
$wgULSAnonCanChangeLanguage is documented as just affecting setting of language for anonymous users via cookies and &setlang=. But currently it also affects the fallback to Accept-Language if $wgULSLanguageDetection is enabled. With this, $wgULSAnonCanChangeLanguage will now only control whether cookies and &setlang= can be used for anonymous users, and keeps $wgULSLanguageDetection independent. Bug: T203179 Change-Id: I6c664ad11dc18b66190dc0644352b91adf87c9e5
This commit is contained in:
@@ -261,11 +261,8 @@ class UniversalLanguageSelectorHooks {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logged out users - less simple
|
// If using cookie storage for anons is OK, read/write from that
|
||||||
if ( !$wgULSAnonCanChangeLanguage ) {
|
if ( $wgULSAnonCanChangeLanguage ) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Language change
|
// Language change
|
||||||
if ( Language::isSupportedLanguage( $languageToSave ) ) {
|
if ( Language::isSupportedLanguage( $languageToSave ) ) {
|
||||||
$request->response()->setCookie( 'language', $languageToSave );
|
$request->response()->setCookie( 'language', $languageToSave );
|
||||||
@@ -281,6 +278,7 @@ class UniversalLanguageSelectorHooks {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// As last resort, try Accept-Language headers if allowed
|
// As last resort, try Accept-Language headers if allowed
|
||||||
if ( $wgULSLanguageDetection ) {
|
if ( $wgULSLanguageDetection ) {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
"ULSEnableAnon": true,
|
"ULSEnableAnon": true,
|
||||||
"@ULSAnonCanChangeLanguage": "Allow anonymous users to change language with cookie and setlang query parameter. Do not use if you are caching anonymous page views without taking cookies into account. Does not have any effect if either of $wgULSEnable or $wgULSEnableAnon is set to false. @since 2013.04",
|
"@ULSAnonCanChangeLanguage": "Allow anonymous users to change language with cookie and setlang query parameter. Do not use if you are caching anonymous page views without taking cookies into account. Does not have any effect if either of $wgULSEnable or $wgULSEnableAnon is set to false. @since 2013.04",
|
||||||
"ULSAnonCanChangeLanguage": true,
|
"ULSAnonCanChangeLanguage": true,
|
||||||
"@ULSLanguageDetection": "Try to use preferred interface language for anonymous users. Do not use if you are caching anonymous page views without taking Accept-Language into account. Does not have any effect if any of $wgULSEnable, $wgULSEnableAnon or $wgULSAnonCanChangeLanguage is set to false.",
|
"@ULSLanguageDetection": "Try to use preferred interface language for anonymous users. Do not use if you are caching anonymous page views without taking Accept-Language into account. Does not have any effect if any of $wgULSEnable, or $wgULSEnableAnon is set to false.",
|
||||||
"ULSLanguageDetection": true,
|
"ULSLanguageDetection": true,
|
||||||
"@ULSIMEEnabled": "Enable the input methods feature for all users by default. Can be controlled by the user.",
|
"@ULSIMEEnabled": "Enable the input methods feature for all users by default. Can be controlled by the user.",
|
||||||
"ULSIMEEnabled": true,
|
"ULSIMEEnabled": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user