r90334 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90333‎ | r90334 | r90335 >
Date:13:12, 18 June 2011
Author:robin
Status:resolved (Comments)
Tags:brion 
Comment:
Follow-up to r90265: directionality improvements as part of bug 6100 (under $wgBetterDirectionality):
* Correct directionality when viewing diffs
* Correct arrows for Pager
* CSS/JS pages always 'en' (LTR)
* Messages on Special:Allmessages have lang and dir attributes based on the selected language
Modified paths:
  • /trunk/phase3/includes/Pager.php (modified) (history)
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserOptions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllmessages.php (modified) (history)
  • /trunk/phase3/skins/common/shared.css (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/shared.css
@@ -715,3 +715,25 @@
716716 unicode-bidi: embed;
717717 }
718718
 719+#mw-clearyourcache, #mw-sitecsspreview, #mw-sitejsspreview, #mw-usercsspreview, #mw-userjspreview {
 720+ direction: ltr;
 721+ unicode-bidi: embed;
 722+}
 723+
 724+/* Correct user & content directionality when viewing a diff */
 725+.diff-currentversion-title, .diff {
 726+ direction: ltr;
 727+ unicode-bidi: embed;
 728+}
 729+/* @noflip */ .diff-contentalign-right td {
 730+ direction: rtl;
 731+ unicode-bidi: embed;
 732+}
 733+/* @noflip */ .diff-contentalign-left td {
 734+ direction: ltr;
 735+ unicode-bidi: embed;
 736+}
 737+.diff-otitle, .diff-ntitle, .diff-lineno {
 738+ direction: ltr !important;
 739+ unicode-bidi: embed;
 740+}
Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -506,7 +506,8 @@
507507 global $wgOut, $wgUser;
508508 wfProfileIn( __METHOD__ );
509509 # Add "current version as of X" title
510 - $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
 510+ $wgOut->addHTML( "<hr class='diff-hr' />
 511+ <h2 class='diff-currentversion-title'>{$this->mPagetitle}</h2>\n" );
511512 # Page content may be handled by a hooked call instead...
512513 if ( wfRunHooks( 'ArticleContentOnDiff', array( $this, $wgOut ) ) ) {
513514 # Use the current version parser cache if applicable
@@ -935,7 +936,17 @@
936937 * @return string
937938 */
938939 static function addHeader( $diff, $otitle, $ntitle, $multi = '', $notice = '' ) {
939 - $header = "<table class='diff'>";
 940+ global $wgBetterDirectionality;
 941+ $dirclass = '';
 942+ if( $wgBetterDirectionality ) {
 943+ global $wgContLang, $wgOut, $wgTitle;
 944+ // shared.css sets diff in interface language/dir,
 945+ // but the actual content should be in the page language/dir
 946+ $getPageLang = $wgOut->parserOptions()->getTargetLanguage( $wgTitle );
 947+ $pageLang = ( $getPageLang ? $getPageLang : $wgContLang );
 948+ $dirclass = ' diff-contentalign-'.$pageLang->alignStart();
 949+ }
 950+ $header = "<table class='diff $dirclass'>";
940951 if ( $diff ) { // Safari/Chrome show broken output if cols not used
941952 $header .= "
942953 <col class='diff-marker' />
Index: trunk/phase3/includes/parser/ParserOptions.php
@@ -67,8 +67,10 @@
6868 function getTidy() { return $this->mTidy; }
6969 function getInterfaceMessage() { return $this->mInterfaceMessage; }
7070 function getTargetLanguage( $title = null ) {
71 - // Parse mediawiki messages with correct target language
72 - if ( $title && $title->getNamespace() == NS_MEDIAWIKI ) {
 71+ if ( $title && $title->isCssOrJsPage() ) {
 72+ return Language::factory( 'en' ); // css/js should always be LTR
 73+ } elseif ( $title && $title->getNamespace() == NS_MEDIAWIKI ) {
 74+ // Parse mediawiki messages with correct target language
7375 list( /* $unused */, $lang ) = MessageCache::singleton()->figureMessage( $title->getText() );
7476 $obj = wfGetLangObj( $lang );
7577 return $obj;
Index: trunk/phase3/includes/specials/SpecialAllmessages.php
@@ -411,7 +411,10 @@
412412 }
413413
414414 function getCellAttrs( $field, $value ){
415 - if( $this->mCurrentRow->am_customised && $field == 'am_title' ){
 415+ global $wgBetterDirectionality;
 416+ if( $field != 'am_title' && $wgBetterDirectionality ) {
 417+ return array( 'lang' => $this->langcode, 'dir' => $this->lang->getDir() );
 418+ } elseif( $this->mCurrentRow->am_customised && $field == 'am_title' ) {
416419 return array( 'rowspan' => '2', 'class' => $field );
417420 } else {
418421 return array( 'class' => $field );
Index: trunk/phase3/includes/Pager.php
@@ -945,7 +945,7 @@
946946 * A navigation bar with images
947947 */
948948 function getNavigationBar() {
949 - global $wgStylePath, $wgContLang;
 949+ global $wgStylePath, $wgContLang, $wgLang, $wgBetterDirectionality;
950950
951951 if ( !$this->isNavigationBarShown() ) {
952952 return '';
@@ -970,7 +970,8 @@
971971 'next' => 'arrow_disabled_right_25.png',
972972 'last' => 'arrow_disabled_last_25.png',
973973 );
974 - if( $wgContLang->isRTL() ) {
 974+ $isRTL = ( $wgBetterDirectionality ? $wgLang->isRTL() : $wgContLang->isRTL() );
 975+ if( $isRTL ) {
975976 $keys = array_keys( $labels );
976977 $images = array_combine( $keys, array_reverse( $images ) );
977978 $disabledImages = array_combine( $keys, array_reverse( $disabledImages ) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r90412Follow up r90334....platonides18:53, 19 June 2011
r90517* Improvements as part of bug 6100: Use wfUILang() instead of $wgContLang whe...robin10:14, 21 June 2011
r90581Directionality improvements as part of bug 6100 (under $wgBetterDirectionalit...robin13:10, 22 June 2011
r90734(bug 12406) Pages with names in RTL scripts are not listed correctly in Speci...robin20:25, 24 June 2011
r90742Directionality and language improvements as part of bug 6100 (under $wgBetter...robin22:10, 24 June 2011
r90743Directionality improvements as part of bug 6100 (under $wgBetterDirectionality):...robin23:01, 24 June 2011
r91066Follow-up r90334 and r90337: made DifferenceEngine::addHeader() non-static to...ialex10:51, 29 June 2011
r91315* Add release notes for my recent commits (bug 6100 and others like bugs 2803...robin22:50, 1 July 2011
r91518(bug 6100; follow-up to r91315) Being bold and removing $wgBetterDirectionali...robin02:26, 6 July 2011
r99021* (bug 31380) Fix style regression on Special:Allmessages...brion18:37, 5 October 2011
r99023MFT r99021: fix bug 31380 (regression from r90334)brion18:39, 5 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r14495* (bug 6100) BiDi: different directionality for user interface and wiki conte...nikerabbit15:19, 31 May 2006
r44000(bug 6100) Strip Unicode BiDi embedding/override characters (U+202A - U+202E)...vyznev20:11, 27 November 2008
r60786Make LTR wgLang do the right thing on RTL wgContLang wikis. See bug 6100 and...mah09:32, 7 January 2010
r90264(part of bug 6100) Set the directionality based on user language instead of c...robin11:32, 17 June 2011
r90265Improve lang and dir of content div (when $wgBetterDirectionality is enabled):...robin11:49, 17 June 2011
r90320Follow-up to r90265: directionality improvements as part of bug 6100 (under $...robin21:48, 17 June 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   18:31, 5 October 2011

Change to SpecialAllmessages removes highlighting classes from table cells: bug 31380

#Comment by Brion VIBBER (talk | contribs)   18:41, 5 October 2011

Resolved in r99021; returning to 'new' state.

Status & tagging log