From: Catrope Date: Fri, 15 May 2015 16:56:50 +0000 (+0000) Subject: Revert "Follow-up ee320648fd1: output mw-content-{ltr,rtl} unconditionally" X-Git-Tag: 1.31.0-rc.0~11399^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=4d2932efd22c7fafbf5ad5b4a2be614ceba966d1;p=lhc%2Fweb%2Fwiklou.git Revert "Follow-up ee320648fd1: output mw-content-{ltr,rtl} unconditionally" This reverts commit 143c81451eb841b8dfc886dcc6c5d794837b4fc2. Applying mw-content-{ltr,rtl} to non-view pages caused problems, like on the history page. MediaWiki:*.js pages always have ltr as their content directionality, but the history page should be in the UI directionality regardless of what the content directionality of the page is (since none of the page content is even displayed!) Bug: T99258 Change-Id: I87dea50e00b0833f077418ac8581d909f0b77746 --- diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index d7e01323c0..5364719e29 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -421,11 +421,15 @@ class SkinTemplate extends Skin { $realBodyAttribs = array( 'id' => 'mw-content-text' ); # Add a mw-content-ltr/rtl class to be able to style based on text direction - # when the content is different from the UI language - $pageLang = $title->getPageViewLanguage(); - $realBodyAttribs['lang'] = $pageLang->getHtmlCode(); - $realBodyAttribs['dir'] = $pageLang->getDir(); - $realBodyAttribs['class'] = 'mw-content-' . $pageLang->getDir(); + # when the content is different from the UI language, i.e.: + # not for special pages or file pages AND only when viewing + if ( !in_array( $title->getNamespace(), array( NS_SPECIAL, NS_FILE ) ) && + Action::getActionName( $this ) === 'view' ) { + $pageLang = $title->getPageViewLanguage(); + $realBodyAttribs['lang'] = $pageLang->getHtmlCode(); + $realBodyAttribs['dir'] = $pageLang->getDir(); + $realBodyAttribs['class'] = 'mw-content-' . $pageLang->getDir(); + } $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext ); $tpl->setRef( 'bodytext', $out->mBodytext );