http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90581

Revision: 90581
Author:   robin
Date:     2011-06-22 13:10:46 +0000 (Wed, 22 Jun 2011)
Log Message:
-----------
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
    trunk/phase3/includes/SkinTemplate.php

Modified: trunk/phase3/includes/ImagePage.php
===================================================================
--- trunk/phase3/includes/ImagePage.php 2011-06-22 12:03:23 UTC (rev 90580)
+++ trunk/phase3/includes/ImagePage.php 2011-06-22 13:10:46 UTC (rev 90581)
@@ -113,7 +113,13 @@
 
                # No need to display noarticletext, we use our own message, 
output in openShowImage()
                if ( $this->getID() ) {
+                       # When $wgBetterDirectionality is enabled, NS_FILE is 
in the user language,
+                       # but this section (the actual wikitext) should be in 
page content language
+                       $pageLang = $this->mTitle->getPageLanguage();
+                       $wgOut->addHTML( Xml::openElement( 'div', array( 'id' 
=> 'mw-imagepage-content',
+                               'lang' => $pageLang->getCode(), 'dir' => 
$pageLang->getDir() ) ) );
                        parent::view();
+                       $wgOut->addHTML( Xml::closeElement( 'div' ) );
                } else {
                        # Just need to set the right headers
                        $wgOut->setArticleFlag( true );
@@ -302,7 +308,7 @@
 
        protected function openShowImage() {
                global $wgOut, $wgUser, $wgImageLimits, $wgRequest,
-                       $wgLang, $wgContLang, $wgEnableUploads;
+                       $wgLang, $wgEnableUploads;
 
                $this->loadFile();
 
@@ -321,7 +327,7 @@
                $maxWidth = $max[0];
                $maxHeight = $max[1];
                $sk = $wgUser->getSkin();
-               $dirmark = $wgContLang->getDirMark();
+               $dirmark = wfUILang()->getDirMark();
 
                if ( $this->displayImg->exists() ) {
                        # image

Modified: trunk/phase3/includes/SkinTemplate.php
===================================================================
--- trunk/phase3/includes/SkinTemplate.php      2011-06-22 12:03:23 UTC (rev 
90580)
+++ trunk/phase3/includes/SkinTemplate.php      2011-06-22 13:10:46 UTC (rev 
90581)
@@ -456,9 +456,9 @@
 
                global $wgBetterDirectionality;
                if ( $wgBetterDirectionality ) {
-                       // not for special pages AND only when viewing AND if 
the page exists
+                       // not for special pages or file pages AND only when 
viewing AND if the page exists
                        // (or is in MW namespace, because that has default 
content)
-                       if( $this->getTitle()->getNamespace() != NS_SPECIAL &&
+                       if( !in_array( $this->getTitle()->getNamespace(), 
array( NS_SPECIAL, NS_FILE ) ) &&
                                in_array( $action, array( 'view', 'render', 
'print' ) ) &&
                                ( $this->getTitle()->exists() || 
$this->getTitle()->getNamespace() == NS_MEDIAWIKI ) ) {
                                $pageLang = 
$this->getTitle()->getPageLanguage();


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to