r107380 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107379‎ | r107380 | r107381 >
Date:13:43, 27 December 2011
Author:mah
Status:ok
Tags:
Comment:
Revert r106546 based on IAlex's CR comments. I've already updated
Bug #30047 to let the submitter know this need to be fixed.
Modified paths:
  • /trunk/extensions/LanguageSelector/LanguageSelector.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LanguageSelector/LanguageSelector.php
@@ -32,7 +32,6 @@
3333 define( 'LANGUAGE_SELECTOR_USE_CONTENT_LANG', 0 ); #no detection
3434 define( 'LANGUAGE_SELECTOR_PREFER_CONTENT_LANG', 1 ); #use content language if accepted by the client
3535 define( 'LANGUAGE_SELECTOR_PREFER_CLIENT_LANG', 2 ); #use language most preferred by the client
36 -define( 'LANGUAGE_SELECTOR_ADJUST_CONTENT', 3 );
3736
3837 /**
3938 * Language detection mode for anonymous visitors.
@@ -90,32 +89,7 @@
9190 $dir = dirname(__FILE__) . '/';
9291 $wgExtensionMessagesFiles['LanguageSelector'] = $dir . 'LanguageSelector.i18n.php';
9392 $wgJSAutoloadClasses['LanguageSelector'] = 'extensions/LanguageSelector/LanguageSelector.js';
94 -$wgHooks['BeforeInitialize'][] = 'wfLanguageSelectorAdjustContent';
9593
96 -function wfLanguageSelectorAdjustContent( &$title, &$article, &$output, &$user, $request, $this ) {
97 - global $wgLanguageSelectorRequestedLanguage, $wgLanguageNames, $wgLanguageSelectorAdjustContent;
98 - if( isset($wgLanguageSelectorRequestedLanguage) && strlen($wgLanguageSelectorRequestedLanguage)>0){
99 - if( isset($wgLanguageSelectorAdjustContent) && $wgLanguageSelectorAdjustContent=== LANGUAGE_SELECTOR_ADJUST_CONTENT){
100 - $langstr="/".$wgLanguageSelectorRequestedLanguage;
101 - $searchstr="#/(". implode('|',array_keys($wgLanguageNames)) ."$)#";
102 - if(preg_match($searchstr,$title->mTextform)){
103 - $title->mTextform =preg_replace($searchstr,$langstr, $title->mTextform);
104 - $title->mUrlform =preg_replace($searchstr,$langstr, $title->mUrlform);
105 - $title->mDbkeyform =preg_replace($searchstr,$langstr, $title->mDbkeyform);
106 - $title->mUserCaseDBKey =preg_replace($searchstr,$langstr, $title->mUserCaseDBKey);
107 - }else{
108 - if($_GET['setlang']== $wgLanguageSelectorRequestedLanguage){
109 - $title->mTextform.=$langstr;
110 - $title->mUrlform.=$langstr;
111 - $title->mDbkeyform.=$langstr;
112 - $title->mUserCaseDBKey.=$langstr;
113 - }
114 - }
115 - }
116 - }
117 - return true;
118 -}
119 -
12094 /**
12195 * @param $parser Parser
12296 * @return bool

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106546Bug 30047 - Language selection does not change the Content-language...mah01:49, 18 December 2011

Status & tagging log