if( !is_array( $target ) ) {
$target = array( $target );
}
- $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr';
+ $imageDir = $wgContLang->getDir();
$imageUrl = $wgStylePath . '/common/images/redirect' . $imageDir . '.png';
$imageUrl2 = $wgStylePath . '/common/images/nextredirect' . $imageDir . '.png';
$alt2 = $wgContLang->isRTL() ? '←' : '→'; // should -> and <- be used instead of entities?
# If thumbnail width has not been provided, it is set
# to the default user option as specified in Language*.php
if ( $fp['align'] == '' ) {
- $fp['align'] = $wgContLang->isRTL() ? 'left' : 'right';
+ $fp['align'] = $wgContLang->alignEnd();
}
return $prefix.$this->makeThumbLink2( $title, $file, $fp, $hp, $time, $query ).$postfix;
}
$this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ));
}
- $dir = $wgContLang->isRTL() ? 'rtl' : 'ltr';
+ $dir = $wgContLang->getDir();
if ( $wgHtml5 ) {
$ret .= "<!doctype html>\n";
if( isset( $options['dir'] ) ) {
global $wgContLang;
- $siteDir = $wgContLang->isRTL() ? 'rtl' : 'ltr';
+ $siteDir = $wgContLang->getDir();
if( $siteDir != $options['dir'] )
return '';
}
'last' => 'table_pager_last',
);
$images = array(
- 'first' => $wgContLang->isRTL() ? 'arrow_last_25.png' : 'arrow_first_25.png',
- 'prev' => $wgContLang->isRTL() ? 'arrow_right_25.png' : 'arrow_left_25.png',
- 'next' => $wgContLang->isRTL() ? 'arrow_left_25.png' : 'arrow_right_25.png',
- 'last' => $wgContLang->isRTL() ? 'arrow_first_25.png' : 'arrow_last_25.png',
+ 'first' => 'arrow_first_25.png',
+ 'prev' => 'arrow_left_25.png',
+ 'next' => 'arrow_right_25.png',
+ 'last' => 'arrow_last_25.png',
);
$disabledImages = array(
- 'first' => $wgContLang->isRTL() ? 'arrow_disabled_last_25.png' : 'arrow_disabled_first_25.png',
- 'prev' => $wgContLang->isRTL() ? 'arrow_disabled_right_25.png' : 'arrow_disabled_left_25.png',
- 'next' => $wgContLang->isRTL() ? 'arrow_disabled_left_25.png' : 'arrow_disabled_right_25.png',
- 'last' => $wgContLang->isRTL() ? 'arrow_disabled_first_25.png' : 'arrow_disabled_last_25.png',
+ 'first' => 'arrow_disabled_first_25.png',
+ 'prev' => 'arrow_disabled_left_25.png',
+ 'next' => 'arrow_disabled_right_25.png',
+ 'last' => 'arrow_disabled_last_25.png',
);
+ if( $wgContLang->isRTL() ) {
+ $keys = array_keys( $labels );
+ $images = array_combine( $keys, array_reverse( $images ) );
+ $disabledImages = array_combine( $keys, array_reverse( $disabledImages ) );
+ }
$linkTexts = array();
$disabledTexts = array();
$a['onload'] = $wgOut->getOnloadHandler();
$a['class'] =
'mediawiki' .
- ' '.( $wgContLang->isRTL() ? 'rtl' : 'ltr' ).
+ ' '.( $wgContLang->getDir() ).
' '.$this->getPageClasses( $this->mTitle ) .
' skin-'. Sanitizer::escapeClass( $this->getSkinName() );
return $a;
} elseif( $left ) {
$s .= $this->getQuickbarCompensator( $rows );
}
- $l = $wgContLang->isRTL() ? 'right' : 'left';
+ $l = $wgContLang->alignStart();
$s .= "<td {$borderhack} align='$l' valign='top'>\n";
$s .= $this->topLinks();
$s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n";
- $r = $wgContLang->isRTL() ? 'left' : 'right';
+ $r = $wgContLang->alignEnd();
$s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
$s .= $this->nameAndLogin();
$s .= "\n<br />" . $this->searchForm() . "</td>";
// Use Unicode bidi embedding override characters,
// to make sure links don't smash each other up in ugly ways.
- $dir = $wgContLang->isRTL() ? 'rtl' : 'ltr';
+ $dir = $wgContLang->getDir();
$embed = "<span dir='$dir'>";
$pop = '</span>';
$tpl->setRef( 'serverurl', $wgServer );
$tpl->setRef( 'logopath', $wgLogo );
$tpl->setRef( 'lang', $wgContLanguageCode );
- $tpl->set( 'dir', $wgContLang->isRTL() ? 'rtl' : 'ltr' );
+ $tpl->set( 'dir', $wgContLang->getDir() );
$tpl->set( 'rtl', $wgContLang->isRTL() );
$tpl->set( 'capitalizeallnouns', $wgLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '' );
$tpl->set( 'langname', $wgContLang->getLanguageName( $wgContLanguageCode ) );
);
if( $hash != '' ) {
- $align = $wgContLang->isRtl() ? 'left' : 'right';
+ $align = $wgContLang->alignEnd();
# Show a thumbnail of the file
$img = wfFindFile( $title );
global $wgUser, $wgContLang;
// Check for uppercase extension. We allow these filenames but check if an image
// with lowercase extension exists already
- $warning = '';
- $align = $wgContLang->isRtl() ? 'left' : 'right';
-
if( $exists === false )
return '';
$warning = '';
- $align = $wgContLang->isRtl() ? 'left' : 'right';
+ $align = $wgContLang->alignEnd();
list( $existsType, $file ) = $exists;
$this->setHeaders();
$this->outputHeader();
- if( $wgContLang->isRTL() ) {
- $wgOut->addHTML( '<div dir="rtl">' );
- } else {
- $wgOut->addHTML( '<div dir="ltr">' );
- }
+ $wgOut->addHTML( Xml::openElement( 'div',
+ array( 'dir' => $wgContLang->getDir() ) ) );
$text =
$this->MediaWikiCredits() .
$this->softwareInformation() .
function isRTL() {
return self::$dataCache->getItem( $this->mCode, 'rtl' );
}
+
+ /**
+ * Return the correct HTML 'dir' attribute value for this language.
+ * @return String
+ */
+ function getDir() {
+ return $this->isRTL() ? 'rtl' : 'ltr';
+ }
+
+ /**
+ * Return 'left' or 'right' as appropriate alignment for line-start
+ * for this language's text direction.
+ *
+ * Should be equivalent to CSS3 'start' text-align value....
+ *
+ * @return String
+ */
+ function alignStart() {
+ return $this->isRTL() ? 'right' : 'left';
+ }
+
+ /**
+ * Return 'right' or 'left' as appropriate alignment for line-end
+ * for this language's text direction.
+ *
+ * Should be equivalent to CSS3 'end' text-align value....
+ *
+ * @return String
+ */
+ function alignEnd() {
+ return $this->isRTL() ? 'left' : 'right';
+ }
/**
* A hidden direction mark (LRM or RLM), depending on the language direction
}
wfProfileOut( __METHOD__ . '-2' );
wfProfileIn( __METHOD__ . '-3' );
- $l = $wgContLang->isRTL() ? 'right' : 'left';
+ $l = $wgContLang->alignStart();
$s .= "<td class='bottom' align='$l' valign='top'>";
$s .= $this->bottomLinks();