r9918 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r9917‎ | r9918 | r9919 >
Date:05:21, 5 July 2005
Author:zhengzhu
Status:old
Tags:
Comment:
Make language variant selection work again for zh
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/languages/LanguageConverter.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES
@@ -473,6 +473,7 @@
474474 * (bug 2674) Include some site configuration info in export data:
475475 namespaces definitions, case-sensitivity, site name, version.
476476 * Use xml:space="preserve" hint on export <text> elements
 477+* Make language variant selection work again for zh
477478
478479
479480 === Caveats ===
Index: trunk/phase3/languages/LanguageConverter.php
@@ -92,23 +92,26 @@
9393 // get language variant preference from logged in users
9494 if(is_object($wgUser) && $wgUser->isLoggedIn() ) {
9595 $this->mPreferredVariant = $wgUser->getOption('variant');
 96+ return $this->mPreferredVariant;
9697 }
9798
9899 # FIXME rewrite code for parsing http header. The current code
99100 # is written specific for detecting zh- variants
100101 if( !$this->mPreferredVariant ) {
101 - // see if some zh- variant is set in the http header,
102 - $this->mPreferredVariant=$this->mMainLanguageCode;
 102+ // see if some supported language variant is set in the
 103+ // http header, but we don't set the mPreferredVariant
 104+ // variable in case this is called before the user's
 105+ // preference is loaded
 106+ $pv=$this->mMainLanguageCode;
103107 if(array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) {
104108 $header = str_replace( '_', '-', strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"]));
105109 $zh = strstr($header, 'zh-');
106110 if($zh) {
107 - $this->mPreferredVariant = substr($zh,0,5);
 111+ $pv = substr($zh,0,5);
108112 }
109113 }
 114+ return $pv;
110115 }
111 -
112 - return $this->mPreferredVariant;
113116 }
114117
115118 /**

Status & tagging log