r90581 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90580‎ | r90581 | r90582 >
Date:13:10, 22 June 2011
Author:robin
Status:ok
Tags:
Comment:
Directionality improvements as part of bug 6100 (under $wgBetterDirectionality) for the File namespace:
* exclude File namespace from div with lang & dir attributes, since most information on file pages is in the user language
* add <div id="mw-imagepage-content"> around the actual wikitext that is in the content language
Modified paths:
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ImagePage.php
@@ -113,7 +113,13 @@
114114
115115 # No need to display noarticletext, we use our own message, output in openShowImage()
116116 if ( $this->getID() ) {
 117+ # When $wgBetterDirectionality is enabled, NS_FILE is in the user language,
 118+ # but this section (the actual wikitext) should be in page content language
 119+ $pageLang = $this->mTitle->getPageLanguage();
 120+ $wgOut->addHTML( Xml::openElement( 'div', array( 'id' => 'mw-imagepage-content',
 121+ 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() ) ) );
117122 parent::view();
 123+ $wgOut->addHTML( Xml::closeElement( 'div' ) );
118124 } else {
119125 # Just need to set the right headers
120126 $wgOut->setArticleFlag( true );
@@ -302,7 +308,7 @@
303309
304310 protected function openShowImage() {
305311 global $wgOut, $wgUser, $wgImageLimits, $wgRequest,
306 - $wgLang, $wgContLang, $wgEnableUploads;
 312+ $wgLang, $wgEnableUploads;
307313
308314 $this->loadFile();
309315
@@ -321,7 +327,7 @@
322328 $maxWidth = $max[0];
323329 $maxHeight = $max[1];
324330 $sk = $wgUser->getSkin();
325 - $dirmark = $wgContLang->getDirMark();
 331+ $dirmark = wfUILang()->getDirMark();
326332
327333 if ( $this->displayImg->exists() ) {
328334 # image
Index: trunk/phase3/includes/SkinTemplate.php
@@ -456,9 +456,9 @@
457457
458458 global $wgBetterDirectionality;
459459 if ( $wgBetterDirectionality ) {
460 - // not for special pages AND only when viewing AND if the page exists
 460+ // not for special pages or file pages AND only when viewing AND if the page exists
461461 // (or is in MW namespace, because that has default content)
462 - if( $this->getTitle()->getNamespace() != NS_SPECIAL &&
 462+ if( !in_array( $this->getTitle()->getNamespace(), array( NS_SPECIAL, NS_FILE ) ) &&
463463 in_array( $action, array( 'view', 'render', 'print' ) ) &&
464464 ( $this->getTitle()->exists() || $this->getTitle()->getNamespace() == NS_MEDIAWIKI ) ) {
465465 $pageLang = $this->getTitle()->getPageLanguage();

Follow-up revisions

RevisionCommit summaryAuthorDate
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
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

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
r90320Follow-up to r90265: directionality improvements as part of bug 6100 (under $...robin21:48, 17 June 2011
r90334Follow-up to r90265: directionality improvements as part of bug 6100 (under $...robin13:12, 18 June 2011
r90517* Improvements as part of bug 6100: Use wfUILang() instead of $wgContLang whe...robin10:14, 21 June 2011

Status & tagging log