Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -4012,7 +4012,10 @@ |
4013 | 4013 | if ( $dot ) { |
4014 | 4014 | $numbering .= '.'; |
4015 | 4015 | } |
4016 | | - $numbering .= $wgContLang->formatNum( $sublevelCount[$i] ); |
| 4016 | + global $wgBetterDirectionality; |
| 4017 | + $pagelang = $this->mTitle->getPageLanguage(); |
| 4018 | + $toclang = ( $wgBetterDirectionality ? $pagelang : $wgContLang ); |
| 4019 | + $numbering .= $toclang->formatNum( $sublevelCount[$i] ); |
4017 | 4020 | $dot = 1; |
4018 | 4021 | } |
4019 | 4022 | } |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -4223,23 +4223,34 @@ |
4224 | 4224 | } |
4225 | 4225 | |
4226 | 4226 | /** |
4227 | | - * Get the language this page is written in |
4228 | | - * Defaults to $wgContLang |
| 4227 | + * Get the language in which the content of this page is written. |
| 4228 | + * Defaults to $wgContLang, but in certain cases it can be e.g. |
| 4229 | + * $wgLang (such as special pages, which are in the user language). |
4229 | 4230 | * |
4230 | 4231 | * @return object Language |
4231 | 4232 | */ |
4232 | 4233 | public function getPageLanguage() { |
4233 | | - global $wgContLang; |
4234 | | - $pageLang = $wgContLang; |
4235 | | - if ( $this->isCssOrJsPage() ) { |
| 4234 | + global $wgLang; |
| 4235 | + if ( $this->getNamespace() == NS_SPECIAL ) { |
| 4236 | + // special pages are in the user language |
| 4237 | + return $wgLang; |
| 4238 | + } elseif ( $this->isRedirect() ) { |
| 4239 | + // the arrow on a redirect page is aligned according to the user language |
| 4240 | + return $wgLang; |
| 4241 | + } elseif ( $this->isCssOrJsPage() ) { |
4236 | 4242 | // css/js should always be LTR and is, in fact, English |
4237 | | - $pageLang = wfGetLangObj( 'en' ); |
| 4243 | + return wfGetLangObj( 'en' ); |
4238 | 4244 | } elseif ( $this->getNamespace() == NS_MEDIAWIKI ) { |
4239 | 4245 | // Parse mediawiki messages with correct target language |
4240 | 4246 | list( /* $unused */, $lang ) = MessageCache::singleton()->figureMessage( $this->getText() ); |
4241 | | - $pageLang = wfGetLangObj( $lang ); |
| 4247 | + return wfGetLangObj( $lang ); |
4242 | 4248 | } |
4243 | | - return $pageLang; |
| 4249 | + global $wgContLang; |
| 4250 | + // If nothing special, it should be in the wiki content language |
| 4251 | + $pageLang = $wgContLang; |
| 4252 | + // Hook at the end because we don't want to override the above stuff |
| 4253 | + wfRunHooks( 'PageContentLanguage', array( $this, &$pageLang, $wgLang ) ); |
| 4254 | + return wfGetLangObj( $pageLang ); |
4244 | 4255 | } |
4245 | 4256 | } |
4246 | 4257 | |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -1624,13 +1624,13 @@ |
1625 | 1625 | * @return string containing HMTL with redirect link |
1626 | 1626 | */ |
1627 | 1627 | public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) { |
1628 | | - global $wgOut, $wgContLang, $wgStylePath; |
| 1628 | + global $wgOut, $wgStylePath; |
1629 | 1629 | |
1630 | 1630 | if ( !is_array( $target ) ) { |
1631 | 1631 | $target = array( $target ); |
1632 | 1632 | } |
1633 | 1633 | |
1634 | | - $imageDir = $wgContLang->getDir(); |
| 1634 | + $imageDir = wfUILang()->getDir(); |
1635 | 1635 | |
1636 | 1636 | if ( $appendSubtitle ) { |
1637 | 1637 | $wgOut->appendSubtitle( wfMsgHtml( 'redirectpagesub' ) ); |
— | — | @@ -1646,7 +1646,7 @@ |
1647 | 1647 | } |
1648 | 1648 | |
1649 | 1649 | $nextRedirect = $wgStylePath . '/common/images/nextredirect' . $imageDir . '.png'; |
1650 | | - $alt = $wgContLang->isRTL() ? '←' : '→'; |
| 1650 | + $alt = wfUILang()->isRTL() ? '←' : '→'; |
1651 | 1651 | // Automatically append redirect=no to each link, since most of them are redirect pages themselves. |
1652 | 1652 | foreach ( $target as $rt ) { |
1653 | 1653 | $link .= Html::element( 'img', array( 'src' => $nextRedirect, 'alt' => $alt ) ); |