* @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' ) );
}
$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 ) );
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' );
* 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 = '';
// 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;
// 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;
+ }
}
}
}