Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | // For translation pages, parse plural, grammar etc with correct language |
21 | 21 | if ( $page = TranslatablePage::isTranslationPage( $title ) ) { |
22 | 22 | list( , $code ) = TranslateUtils::figureMessage( $title->getText() ); |
23 | | - $parser->mOptions->setTargetLanguage( Language::factory( $code ) ); |
| 23 | + $parser->getOptions()->setTargetLanguage( Language::factory( $code ) ); |
24 | 24 | } |
25 | 25 | |
26 | 26 | return true; |
— | — | @@ -195,18 +195,19 @@ |
196 | 196 | // Sort by language code, which seems to be the only sane method |
197 | 197 | ksort( $status ); |
198 | 198 | |
199 | | - $sk = $parser->mOptions->getSkin(); |
| 199 | + $options = $parser->getOptions(); |
200 | 200 | |
201 | | - /* We rely on $wgLang, which should not matter as |
202 | | - * languages are cached per language. However it |
203 | | - * would be nicer to use $parser->getFunctionLang(); |
204 | | - * but that needs to be set correct first. */ |
205 | | - // $lobj = $parser->getFunctionLang(); |
206 | | - global $wgLang; |
| 201 | + $sk = $options->getSkin(); |
| 202 | + if ( method_exists( $options, 'getUserLang' ) ) { |
| 203 | + $userLangCode = $options->getUserLang(); |
| 204 | + } else { |
| 205 | + global $wgLang; |
| 206 | + $userLangCode = $wgLang->getCode(); |
| 207 | + } |
207 | 208 | |
208 | 209 | $languages = array(); |
209 | 210 | foreach ( $status as $code => $percent ) { |
210 | | - $name = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() ); |
| 211 | + $name = TranslateUtils::getLanguageName( $code, false, $userLangCode ); |
211 | 212 | $name = htmlspecialchars( $name ); // Unlikely, but better safe |
212 | 213 | |
213 | 214 | /* Percentages are too accurate and take more |
— | — | @@ -232,7 +233,7 @@ |
233 | 234 | |
234 | 235 | if ( $parser->getTitle()->getText() === $_title->getText() ) { |
235 | 236 | $languages[] = Html::rawElement( 'b', null, "*$name* $percent" ); |
236 | | - } elseif ( $code === $wgLang->getCode() ) { |
| 237 | + } elseif ( $code === $userLangCode ) { |
237 | 238 | $languages[] = $sk->linkKnown( $_title, Html::rawElement( 'b', null, "$name $percent" ) ); |
238 | 239 | } else { |
239 | 240 | $languages[] = $sk->linkKnown( $_title, "$name $percent" ); |