Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -473,6 +473,7 @@ |
474 | 474 | * (bug 2674) Include some site configuration info in export data: |
475 | 475 | namespaces definitions, case-sensitivity, site name, version. |
476 | 476 | * Use xml:space="preserve" hint on export <text> elements |
| 477 | +* Make language variant selection work again for zh |
477 | 478 | |
478 | 479 | |
479 | 480 | === Caveats === |
Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -92,23 +92,26 @@ |
93 | 93 | // get language variant preference from logged in users |
94 | 94 | if(is_object($wgUser) && $wgUser->isLoggedIn() ) { |
95 | 95 | $this->mPreferredVariant = $wgUser->getOption('variant'); |
| 96 | + return $this->mPreferredVariant; |
96 | 97 | } |
97 | 98 | |
98 | 99 | # FIXME rewrite code for parsing http header. The current code |
99 | 100 | # is written specific for detecting zh- variants |
100 | 101 | 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; |
103 | 107 | if(array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) { |
104 | 108 | $header = str_replace( '_', '-', strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])); |
105 | 109 | $zh = strstr($header, 'zh-'); |
106 | 110 | if($zh) { |
107 | | - $this->mPreferredVariant = substr($zh,0,5); |
| 111 | + $pv = substr($zh,0,5); |
108 | 112 | } |
109 | 113 | } |
| 114 | + return $pv; |
110 | 115 | } |
111 | | - |
112 | | - return $this->mPreferredVariant; |
113 | 116 | } |
114 | 117 | |
115 | 118 | /** |