Merge "Add mw-content-ltr|rtl to file redirect pages"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 3 May 2017 14:21:38 +0000 (14:21 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 3 May 2017 14:21:38 +0000 (14:21 +0000)
includes/skins/SkinTemplate.php

index 1dd9a06..f49d46c 100644 (file)
@@ -269,11 +269,13 @@ class SkinTemplate extends Skin {
                # An ID that includes the actual body text; without categories, contentSub, ...
                $realBodyAttribs = [ '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, i.e.:
-               # not for special pages or file pages AND only when viewing
-               if ( !in_array( $title->getNamespace(), [ NS_SPECIAL, NS_FILE ] ) &&
-                       Action::getActionName( $this ) === 'view' ) {
+               # 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 (only
+               # when viewing)
+               # Most information on special pages and file pages is in user language,
+               # rather than content language, so those will not get this
+               if ( Action::getActionName( $this ) === 'view' &&
+                       ( !$title->inNamespaces( NS_SPECIAL, NS_FILE ) || $title->isRedirect() ) ) {
                        $pageLang = $title->getPageViewLanguage();
                        $realBodyAttribs['lang'] = $pageLang->getHtmlCode();
                        $realBodyAttribs['dir'] = $pageLang->getDir();