* A navigation bar with images
*/
function getNavigationBar() {
- global $wgStylePath, $wgContLang;
+ global $wgStylePath, $wgContLang, $wgLang, $wgBetterDirectionality;
if ( !$this->isNavigationBarShown() ) {
return '';
'next' => 'arrow_disabled_right_25.png',
'last' => 'arrow_disabled_last_25.png',
);
- if( $wgContLang->isRTL() ) {
+ $isRTL = ( $wgBetterDirectionality ? $wgLang->isRTL() : $wgContLang->isRTL() );
+ if( $isRTL ) {
$keys = array_keys( $labels );
$images = array_combine( $keys, array_reverse( $images ) );
$disabledImages = array_combine( $keys, array_reverse( $disabledImages ) );
global $wgOut, $wgUser;
wfProfileIn( __METHOD__ );
# Add "current version as of X" title
- $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
+ $wgOut->addHTML( "<hr class='diff-hr' />
+ <h2 class='diff-currentversion-title'>{$this->mPagetitle}</h2>\n" );
# Page content may be handled by a hooked call instead...
if ( wfRunHooks( 'ArticleContentOnDiff', array( $this, $wgOut ) ) ) {
# Use the current version parser cache if applicable
* @return string
*/
static function addHeader( $diff, $otitle, $ntitle, $multi = '', $notice = '' ) {
- $header = "<table class='diff'>";
+ global $wgBetterDirectionality;
+ $dirclass = '';
+ if( $wgBetterDirectionality ) {
+ global $wgContLang, $wgOut, $wgTitle;
+ // shared.css sets diff in interface language/dir,
+ // but the actual content should be in the page language/dir
+ $getPageLang = $wgOut->parserOptions()->getTargetLanguage( $wgTitle );
+ $pageLang = ( $getPageLang ? $getPageLang : $wgContLang );
+ $dirclass = ' diff-contentalign-'.$pageLang->alignStart();
+ }
+ $header = "<table class='diff $dirclass'>";
if ( $diff ) { // Safari/Chrome show broken output if cols not used
$header .= "
<col class='diff-marker' />
function getTidy() { return $this->mTidy; }
function getInterfaceMessage() { return $this->mInterfaceMessage; }
function getTargetLanguage( $title = null ) {
- // Parse mediawiki messages with correct target language
- if ( $title && $title->getNamespace() == NS_MEDIAWIKI ) {
+ if ( $title && $title->isCssOrJsPage() ) {
+ return Language::factory( 'en' ); // css/js should always be LTR
+ } elseif ( $title && $title->getNamespace() == NS_MEDIAWIKI ) {
+ // Parse mediawiki messages with correct target language
list( /* $unused */, $lang ) = MessageCache::singleton()->figureMessage( $title->getText() );
$obj = wfGetLangObj( $lang );
return $obj;
}
function getCellAttrs( $field, $value ){
- if( $this->mCurrentRow->am_customised && $field == 'am_title' ){
+ global $wgBetterDirectionality;
+ if( $field != 'am_title' && $wgBetterDirectionality ) {
+ return array( 'lang' => $this->langcode, 'dir' => $this->lang->getDir() );
+ } elseif( $this->mCurrentRow->am_customised && $field == 'am_title' ) {
return array( 'rowspan' => '2', 'class' => $field );
} else {
return array( 'class' => $field );
unicode-bidi: embed;
}
+#mw-clearyourcache, #mw-sitecsspreview, #mw-sitejsspreview, #mw-usercsspreview, #mw-userjspreview {
+ direction: ltr;
+ unicode-bidi: embed;
+}
+
+/* Correct user & content directionality when viewing a diff */
+.diff-currentversion-title, .diff {
+ direction: ltr;
+ unicode-bidi: embed;
+}
+/* @noflip */ .diff-contentalign-right td {
+ direction: rtl;
+ unicode-bidi: embed;
+}
+/* @noflip */ .diff-contentalign-left td {
+ direction: ltr;
+ unicode-bidi: embed;
+}
+.diff-otitle, .diff-ntitle, .diff-lineno {
+ direction: ltr !important;
+ unicode-bidi: embed;
+}