# 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 );
protected function openShowImage() {
global $wgOut, $wgUser, $wgImageLimits, $wgRequest,
- $wgLang, $wgContLang, $wgEnableUploads;
+ $wgLang, $wgEnableUploads;
$this->loadFile();
$maxWidth = $max[0];
$maxHeight = $max[1];
$sk = $wgUser->getSkin();
- $dirmark = $wgContLang->getDirMark();
+ $dirmark = wfUILang()->getDirMark();
if ( $this->displayImg->exists() ) {
# image
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();