http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97636
Revision: 97636
Author: robin
Date: 2011-09-20 15:55:08 +0000 (Tue, 20 Sep 2011)
Log Message:
-----------
Re-do several things of r96798 in preparation of re-doing the rest (there's a
bug somewhere that needs fixing).
* Do additional validation and is_array() check in LanguageConverter
* Make redirects be in content language again (remove from
Title->getPageLanguage())
* Pass title object from ParserCache to ParserOptions->optionsHash
Modified Paths:
--------------
trunk/phase3/includes/Article.php
trunk/phase3/includes/Title.php
trunk/phase3/includes/parser/ParserOptions.php
trunk/phase3/languages/LanguageConverter.php
Modified: trunk/phase3/includes/Article.php
===================================================================
--- trunk/phase3/includes/Article.php 2011-09-20 15:54:15 UTC (rev 97635)
+++ trunk/phase3/includes/Article.php 2011-09-20 15:55:08 UTC (rev 97636)
@@ -1050,13 +1050,14 @@
* @return string containing HMTL with redirect link
*/
public function viewRedirect( $target, $appendSubtitle = true,
$forceKnown = false ) {
- global $wgOut, $wgLang, $wgStylePath;
+ global $wgOut, $wgStylePath;
if ( !is_array( $target ) ) {
$target = array( $target );
}
- $imageDir = $wgLang->getDir();
+ $lang = $this->getTitle()->getPageLanguage();
+ $imageDir = $lang->getDir();
if ( $appendSubtitle ) {
$wgOut->appendSubtitle( wfMsgHtml( 'redirectpagesub' )
);
@@ -1072,7 +1073,7 @@
}
$nextRedirect = $wgStylePath . '/common/images/nextredirect' .
$imageDir . '.png';
- $alt = $wgLang->isRTL() ? '←' : '→';
+ $alt = $lang->isRTL() ? '←' : '→';
// Automatically append redirect=no to each link, since most of
them are redirect pages themselves.
foreach ( $target as $rt ) {
$link .= Html::element( 'img', array( 'src' =>
$nextRedirect, 'alt' => $alt ) );
Modified: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php 2011-09-20 15:54:15 UTC (rev 97635)
+++ trunk/phase3/includes/Title.php 2011-09-20 15:55:08 UTC (rev 97636)
@@ -4376,9 +4376,6 @@
if ( $this->getNamespace() == NS_SPECIAL ) {
// special pages are in the user language
return $wgLang;
- } elseif ( $this->isRedirect() ) {
- // the arrow on a redirect page is aligned according to
the user language
- return $wgLang;
} elseif ( $this->isCssOrJsPage() ) {
// css/js should always be LTR and is, in fact, English
return wfGetLangObj( 'en' );
Modified: trunk/phase3/includes/parser/ParserOptions.php
===================================================================
--- trunk/phase3/includes/parser/ParserOptions.php 2011-09-20 15:54:15 UTC
(rev 97635)
+++ trunk/phase3/includes/parser/ParserOptions.php 2011-09-20 15:55:08 UTC
(rev 97636)
@@ -274,9 +274,11 @@
* settings.
*
* @since 1.17
+ * @param $forOptions Array
+ * @param $title Title: will be used to get the page content language
* @return \string Page rendering hash
*/
- public function optionsHash( $forOptions ) {
+ public function optionsHash( $forOptions, $title = null ) {
global $wgContLang, $wgRenderHashAppend;
$confstr = '';
Modified: trunk/phase3/languages/LanguageConverter.php
===================================================================
--- trunk/phase3/languages/LanguageConverter.php 2011-09-20 15:54:15 UTC
(rev 97635)
+++ trunk/phase3/languages/LanguageConverter.php 2011-09-20 15:55:08 UTC
(rev 97636)
@@ -158,7 +158,7 @@
// not memoized (i.e. there return value is not cached) since
// new information might appear during processing after this
// is first called.
- if ( $req ) {
+ if ( $this->validateVariant( $req ) ) {
return $req;
}
return $this->mMainLanguageCode;
@@ -1369,14 +1369,16 @@
// then we check its fallback variants.
$variantFallbacks =
$this->mConverter->getVariantFallbacks(
$variant );
- foreach ( $variantFallbacks as $variantFallback
) {
- // if current variant's fallback exist
in flags
- if ( isset(
$this->mVariantFlags[$variantFallback] ) ) {
- // then convert <text to
convert> to fallback language
- $this->mRules =
-
$this->mConverter->autoConvert( $this->mRules,
-
$variantFallback );
- break;
+ if( is_array( $variantFallbacks ) ) {
+ foreach ( $variantFallbacks as
$variantFallback ) {
+ // if current variant's
fallback exist in flags
+ if ( isset(
$this->mVariantFlags[$variantFallback] ) ) {
+ // then convert <text
to convert> to fallback language
+ $this->mRules =
+
$this->mConverter->autoConvert( $this->mRules,
+
$variantFallback );
+ break;
+ }
}
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs