(bug 6100; follow-up to r91315) Being bold and removing $wgBetterDirectionality ...
authorRobin Pepermans <robin@users.mediawiki.org>
Wed, 6 Jul 2011 02:26:06 +0000 (02:26 +0000)
committerRobin Pepermans <robin@users.mediawiki.org>
Wed, 6 Jul 2011 02:26:06 +0000 (02:26 +0000)
Also:
* Introduce classes mw-float-end, mw-float-start so we don't have to use inline css depending on wfUILang()/$wgLang (see HistoryPage and SpecialFileDuplicateSearch)
* Add direction mark to protection log
* Remove specialpageattributes as it is obsoleted by this commit (also fixes bug 28572)
* Add two direction marks in wfSpecialList, which makes ltr links on rtl wiki (and vice versa) display nicely as well (only on those special pages however)
* Revert r91340 partially: use mw-content-ltr/rtl class anyway in shared.css. Both ways have their [dis]advantages...
* Set the direction of input fields by default to the content language direction (except buttons etc.) in shared.css

32 files changed:
RELEASE-NOTES-1.19
includes/Article.php
includes/CategoryPage.php
includes/ChangesList.php
includes/DefaultSettings.php
includes/EditPage.php
includes/GlobalFunctions.php
includes/HistoryPage.php
includes/ImagePage.php
includes/LogEventsList.php
includes/LogPage.php
includes/OutputPage.php
includes/Pager.php
includes/SkinTemplate.php
includes/diff/DifferenceEngine.php
includes/resourceloader/ResourceLoaderContext.php
includes/specials/SpecialAllmessages.php
includes/specials/SpecialBrokenRedirects.php
includes/specials/SpecialContributions.php
includes/specials/SpecialDisambiguations.php
includes/specials/SpecialDoubleRedirects.php
includes/specials/SpecialFileDuplicateSearch.php
includes/specials/SpecialListredirects.php
includes/specials/SpecialNewpages.php
includes/specials/SpecialProtectedpages.php
includes/specials/SpecialShortpages.php
includes/specials/SpecialWhatlinkshere.php
languages/Language.php
skins/Modern.php
skins/MonoBook.php
skins/Vector.php
skins/common/shared.css

index fcb8b39..4b09da3 100644 (file)
@@ -139,8 +139,8 @@ production.
 * Make sure Backlink cache does not retrieve interwiki redirects when looking for
   redirects to a local page.
 * (bug 6100) Allow different directionality (LTR/RTL) for user interface
-  and wiki content, when $wgBetterDirectionality is enabled, along with
-  many RTL improvements (such as bugs 28030, 12406, 28349)
+  and wiki content, along with many other RTL and directionality improvements
+  (such as bugs 28030, 12406, 28349)
 * (bug 29712) Removed broken defaultUserOptionOverrides in MessagesXx files and
   unneeded CSS flipping of quickbar. Instead, introduce option 5 which sets
   left/right according to the directionality of your interface language.
index 585dfd9..84bb07a 100644 (file)
@@ -1043,13 +1043,13 @@ class Article extends Page {
         * @return string containing HMTL with redirect link
         */
        public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) {
-               global $wgOut, $wgStylePath;
+               global $wgOut, $wgLang, $wgStylePath;
 
                if ( !is_array( $target ) ) {
                        $target = array( $target );
                }
 
-               $imageDir = wfUILang()->getDir();
+               $imageDir = $wgLang->getDir();
 
                if ( $appendSubtitle ) {
                        $wgOut->appendSubtitle( wfMsgHtml( 'redirectpagesub' ) );
@@ -1065,7 +1065,7 @@ class Article extends Page {
                }
 
                $nextRedirect = $wgStylePath . '/common/images/nextredirect' . $imageDir . '.png';
-               $alt = wfUILang()->isRTL() ? '←' : '→';
+               $alt = $wgLang->isRTL() ? '←' : '→';
                // Automatically append redirect=no to each link, since most of them are redirect pages themselves.
                foreach ( $target as $rt ) {
                        $link .= Html::element( 'img', array( 'src' => $nextRedirect, 'alt' => $alt ) );
index 7d07299..850256f 100644 (file)
@@ -143,7 +143,7 @@ class CategoryViewer {
         * @return string HTML output
         */
        public function getHTML() {
-               global $wgOut, $wgCategoryMagicGallery, $wgContLang, $wgBetterDirectionality;
+               global $wgOut, $wgCategoryMagicGallery, $wgContLang;
                wfProfileIn( __METHOD__ );
 
                $this->showGallery = $wgCategoryMagicGallery && !$wgOut->mNoGallery;
@@ -174,13 +174,11 @@ class CategoryViewer {
                        $r = wfMsgExt( 'category-empty', array( 'parse' ) );
                }
 
-               if( $wgBetterDirectionality ) {
-                       $pageLang = $this->title->getPageLanguage();
-                       $langAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() );
-                       # close the previous div, show the headings in user language,
-                       # then open a new div with the page content language again
-                       $r = '</div>' . $r . Html::openElement( 'div', $langAttribs );
-               }
+               $pageLang = $this->title->getPageLanguage();
+               $langAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() );
+               # close the previous div, show the headings in user language,
+               # then open a new div with the page content language again
+               $r = '</div>' . $r . Html::openElement( 'div', $langAttribs );
 
                wfProfileOut( __METHOD__ );
                return $wgContLang->convert( $r );
@@ -492,8 +490,6 @@ class CategoryViewer {
         * @private
         */
        function formatList( $articles, $articles_start_char, $cutoff = 6 ) {
-               global $wgBetterDirectionality;
-
                $list = '';
                if ( count ( $articles ) > $cutoff ) {
                        $list = self::columnList( $articles, $articles_start_char );
@@ -502,12 +498,10 @@ class CategoryViewer {
                        $list = self::shortList( $articles, $articles_start_char );
                }
 
-               if( $wgBetterDirectionality ) {
-                       $pageLang = $this->title->getPageLanguage();
-                       $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
-                               'class' => 'mw-content-'.$pageLang->getDir() );
-                       $list = Html::rawElement( 'div', $attribs, $list );
-               }
+               $pageLang = $this->title->getPageLanguage();
+               $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
+                       'class' => 'mw-content-'.$pageLang->getDir() );
+               $list = Html::rawElement( 'div', $attribs, $list );
 
                return $list;
        }
index e8698b4..55e9403 100644 (file)
@@ -323,6 +323,7 @@ class ChangesList {
         * @return void
         */
        public function insertArticleLink( &$s, &$rc, $unpatrolled, $watched ) {
+               global $wgLang;
                # If it's a new article, there is no diff link, but if it hasn't been
                # patrolled yet, we need to give users a way to do so
                $params = array();
@@ -354,7 +355,7 @@ class ChangesList {
                        $articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>";
                }
                # RTL/LTR marker
-               $articlelink .= wfUILang()->getDirMark();
+               $articlelink .= $wgLang->getDirMark();
 
                wfRunHooks( 'ChangesListInsertArticleLink',
                        array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched) );
@@ -590,7 +591,7 @@ class OldChangesList extends ChangesList {
                # User tool links
                $this->insertUserRelatedLinks( $s, $rc );
                # LTR/RTL direction mark
-               $s .= wfUILang()->getDirMark();
+               $s .= $wgLang->getDirMark();
                # Log action text (if any)
                $this->insertAction( $s, $rc );
                # Edit or log comment
@@ -868,7 +869,7 @@ class EnhancedChangesList extends ChangesList {
                $users = array();
                foreach( $userlinks as $userlink => $count) {
                        $text = $userlink;
-                       $text .= wfUILang()->getDirMark();
+                       $text .= $wgLang->getDirMark();
                        if( $count > 1 ) {
                                $text .= ' (' . $wgLang->formatNum( $count ) . '×)';
                        }
@@ -910,7 +911,7 @@ class EnhancedChangesList extends ChangesList {
                        $this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
                }
 
-               $r .= wfUILang()->getDirMark();
+               $r .= $wgLang->getDirMark();
 
                $queryParams['curid'] = $curId;
                # Changes message
index cf92dd4..8dbe338 100644 (file)
@@ -2408,9 +2408,12 @@ $wgVectorShowVariantName = false;
 $wgEdititis = false;
 
 /**
- * Experimental better directionality support.
+ * Better directionality support (bug 6100 and related).
+ * Removed in 1.19, still kept here for LiquidThreads backwards compatibility.
+ *
+ * @deprecated since 1.19
  */
-$wgBetterDirectionality = false;
+$wgBetterDirectionality = true;
 
 
 /** @} */ # End of output format settings }
index a62cbfe..a17b4b1 100644 (file)
@@ -1814,12 +1814,9 @@ HTML
                        'style' => '' // avoid php notices when appending preferences (appending allows customAttribs['style'] to still work
                );
 
-               global $wgBetterDirectionality;
-               if( $wgBetterDirectionality ) {
-                       $pageLang = $this->mTitle->getPageLanguage();
-                       $attribs['lang'] = $pageLang->getCode();
-                       $attribs['dir'] = $pageLang->getDir();
-               }
+               $pageLang = $this->mTitle->getPageLanguage();
+               $attribs['lang'] = $pageLang->getCode();
+               $attribs['dir'] = $pageLang->getDir();
 
                $wgOut->addHTML( Html::textarea( $name, $wikitext, $attribs ) );
        }
@@ -2095,13 +2092,11 @@ HTML
                        '<h2 id="mw-previewheader">' . htmlspecialchars( wfMsg( 'preview' ) ) . "</h2>" .
                        $wgOut->parse( $note ) . $conflict . "</div>\n";
 
-               global $wgBetterDirectionality;
-               if( $wgBetterDirectionality ) {
-                       $pageLang = $this->mTitle->getPageLanguage();
-                       $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
-                               'class' => 'mw-content-'.$pageLang->getDir() );
-                       $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML );
-               }
+               $pageLang = $this->mTitle->getPageLanguage();
+               $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
+                       'class' => 'mw-content-'.$pageLang->getDir() );
+               $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML );
+
                wfProfileOut( __METHOD__ );
                return $previewhead . $previewHTML . $this->previewTextAfterContent;
        }
index 0ff0f98..6d91732 100644 (file)
@@ -910,17 +910,15 @@ function wfGetLangObj( $langcode = false ) {
 }
 
 /**
- * Use this instead of $wgContLang, when working with user interface.
- * User interface is currently hard coded according to wiki content language
- * in many ways, especially regarding to text direction. There is lots stuff
- * to fix, hence this function to keep the old behaviour unless the global
- * $wgBetterDirectionality is enabled (or removed when everything works).
+ * Old function when $wgBetterDirectionality existed
+ * Removed in core, kept in extensions for backwards compat.
  *
+ * @deprecated since 1.19
  * @return Language
  */
 function wfUILang() {
-       global $wgBetterDirectionality;
-       return wfGetLangObj( !$wgBetterDirectionality );
+       global $wgLang;
+       return $wgLang;
 }
 
 /**
@@ -2542,8 +2540,20 @@ function in_string( $needle, $str, $insensitive = false ) {
        return $func( $str, $needle ) !== false;
 }
 
-function wfSpecialList( $page, $details ) {
-       $details = $details ? ' ' . wfUILang()->getDirMark() . "($details)" : '';
+/**
+ * Make a list item, used by various special pages
+ *
+ * @param $page String Page link
+ * @param $details String Text between brackets
+ * @param $oppositedm Boolean  Add the direction mark opposite to your
+ *                                                             language, to display text properly
+ * @return String
+ */
+function wfSpecialList( $page, $details, $oppositedm = true ) {
+       global $wgLang;
+       $dirmark = ( $oppositedm ? $wgLang->getDirMark( true ) : '' ) .
+               $wgLang->getDirMark();
+       $details = $details ? $dirmark . "($details)" : '';
        return $page . $details;
 }
 
index 678c24b..340c152 100644 (file)
@@ -410,15 +410,13 @@ class HistoryPager extends ReverseChronologicalPager {
 
        private function getRevisionButton( $name, $msg ) {
                $this->preventClickjacking();
-               $float = wfUILang()->alignEnd();
                # Note bug #20966, <button> is non-standard in IE<8
                $element = Html::element( 'button',
                        array(
                                'type' => 'submit',
                                'name' => $name,
                                'value' => '1',
-                               'style' => "float: $float;",
-                               'class' => "mw-history-$name-button",
+                               'class' => "mw-history-$name-button mw-float-end",
                        ),
                        wfMsg( $msg )
                ) . "\n";
@@ -533,7 +531,7 @@ class HistoryPager extends ReverseChronologicalPager {
                        $s .= " $del ";
                }
 
-               $dirmark = wfUILang()->getDirMark();
+               $dirmark = $wgLang->getDirMark();
 
                $s .= " $link";
                $s .= $dirmark;
index a461c4e..549dcd6 100644 (file)
@@ -124,8 +124,8 @@ class ImagePage extends Article {
 
                # No need to display noarticletext, we use our own message, output in openShowImage()
                if ( $this->mPage->getID() ) {
-                       # When $wgBetterDirectionality is enabled, NS_FILE is in the user language,
-                       # but this section (the actual wikitext) should be in page content language
+                       # NS_FILE is in the user language, but this section (the actual wikitext)
+                       # should be in page content language
                        $pageLang = $this->getTitle()->getPageLanguage();
                        $wgOut->addHTML( Xml::openElement( 'div', array( 'id' => 'mw-imagepage-content',
                                'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
@@ -273,7 +273,7 @@ class ImagePage extends Article {
                $maxWidth = $max[0];
                $maxHeight = $max[1];
                $sk = $wgUser->getSkin();
-               $dirmark = wfUILang()->getDirMark();
+               $dirmark = $wgLang->getDirMark();
 
                if ( $this->displayImg->exists() ) {
                        # image
index d759017..8dc7e45 100644 (file)
@@ -368,7 +368,8 @@ class LogEventsList {
                        $comment = '<span class="history-deleted">' .
                                wfMsgHtml( 'rev-deleted-comment' ) . '</span>';
                } else {
-                       $comment = wfUILang()->getDirMark() .
+                       global $wgLang;
+                       $comment = $wgLang->getDirMark() .
                                $this->skin->commentBlock( $row->log_comment );
                }
                return $comment;
index 7445631..83dbc9e 100644 (file)
@@ -259,7 +259,7 @@ class LogPage {
                                        } elseif ( $type == 'protect' && count($params) == 3 ) {
                                                // Restrictions and expiries
                                                if( $skin ) {
-                                                       $details .= htmlspecialchars( " {$params[1]}" );
+                                                       $details .= $wgLang->getDirMark() . htmlspecialchars( " {$params[1]}" );
                                                } else {
                                                        $details .= " {$params[1]}";
                                                }
index 3e22f84..1de0b65 100644 (file)
@@ -2257,15 +2257,14 @@ $templates
         * @return String: The doctype, opening <html>, and head element.
         */
        public function headElement( Skin $sk, $includeStyle = true ) {
-               global $wgUseTrackbacks;
+               global $wgUseTrackbacks, $wgLang;
 
                if ( $sk->commonPrintStylesheet() ) {
                        $this->addModuleStyles( 'mediawiki.legacy.wikiprintable' );
                }
                $sk->setupUserCss( $this );
 
-               $lang = wfUILang();
-               $ret = Html::htmlHeader( array( 'lang' => $lang->getCode(), 'dir' => $lang->getDir() ) );
+               $ret = Html::htmlHeader( array( 'lang' => $wgLang->getCode(), 'dir' => $wgLang->getDir() ) );
 
                if ( $this->getHTMLTitle() == '' ) {
                        $this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ) );
@@ -2311,9 +2310,11 @@ $templates
                                Xml::escapeJsString( $editUrl ) . "'";
                }
 
-               # Class bloat
-               $dir = wfUILang()->getDir();
-               $bodyAttrs['class'] = "mediawiki $dir";
+               # Classes for LTR/RTL directionality support
+               global $wgLang, $wgContLang;
+               $userdir = $wgLang->getDir();
+               $sitedir = $wgContLang->getDir();
+               $bodyAttrs['class'] = "mediawiki $userdir sitedir-$sitedir";
 
                if ( $this->getContext()->getLang()->capitalizeAllNouns() ) {
                        # A <body> class is probably not the best way to do this . . .
@@ -3020,8 +3021,8 @@ $templates
         */
        protected function styleLink( $style, $options ) {
                if( isset( $options['dir'] ) ) {
-                       $siteDir = wfUILang()->getDir();
-                       if( $siteDir != $options['dir'] ) {
+                       global $wgLang;
+                       if( $wgLang->getDir() != $options['dir'] ) {
                                return '';
                        }
                }
index 34d9af6..81d9559 100644 (file)
@@ -947,7 +947,7 @@ abstract class TablePager extends IndexPager {
         * A navigation bar with images
         */
        function getNavigationBar() {
-               global $wgStylePath;
+               global $wgStylePath, $wgLang;
 
                if ( !$this->isNavigationBarShown() ) {
                        return '';
@@ -972,7 +972,7 @@ abstract class TablePager extends IndexPager {
                        'next' => 'arrow_disabled_right_25.png',
                        'last' => 'arrow_disabled_last_25.png',
                );
-               if( wfUILang()->isRTL() ) {
+               if( $wgLang->isRTL() ) {
                        $keys = array_keys( $labels );
                        $images = array_combine( $keys, array_reverse( $images ) );
                        $disabledImages = array_combine( $keys, array_reverse( $disabledImages ) );
index e4ff9cb..daa5fa1 100644 (file)
@@ -299,36 +299,31 @@ class SkinTemplate extends Skin {
                $tpl->setRef( 'serverurl', $wgServer );
                $tpl->setRef( 'logopath', $wgLogo );
 
-               $lang = wfUILang();
-               $tpl->set( 'lang', $lang->getCode() );
-               $tpl->set( 'dir', $lang->getDir() );
-               $tpl->set( 'rtl', $lang->isRTL() );
+               $contentlang = $wgContLang->getCode();
+               $contentdir  = $wgContLang->getDir();
+               $userlang = $wgLang->getCode();
+               $userdir  = $wgLang->getDir();
+
+               $tpl->set( 'lang', $userlang );
+               $tpl->set( 'dir', $userdir );
+               $tpl->set( 'rtl', $wgLang->isRTL() );
 
                $tpl->set( 'capitalizeallnouns', $wgLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '' );
                $tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) );
                $tpl->set( 'username', $wgUser->isAnon() ? null : $this->username );
                $tpl->setRef( 'userpage', $this->userpage );
                $tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href'] );
-               $tpl->set( 'userlang', $wgLang->getCode() );
+               $tpl->set( 'userlang', $userlang );
 
                // Users can have their language set differently than the
                // content of the wiki. For these users, tell the web browser
                // that interface elements are in a different language.
                $tpl->set( 'userlangattributes', '' );
-               $tpl->set( 'specialpageattributes', '' );
-
-               $lang = $wgLang->getCode();
-               $dir  = $wgLang->getDir();
-               if ( $lang !== $wgContLang->getCode() || $dir !== $wgContLang->getDir() ) {
-                       $attrs = " lang='$lang' dir='$dir'";
+               $tpl->set( 'specialpageattributes', '' ); # obsolete
 
+               if ( $userlang !== $contentlang || $userdir !== $contentdir ) {
+                       $attrs = " lang='$userlang' dir='$userdir'";
                        $tpl->set( 'userlangattributes', $attrs );
-
-                       // The content of SpecialPages should be presented in the
-                       // user's language. Content of regular pages should not be touched.
-                       if( $this->getTitle()->isSpecialPage() ) {
-                               $tpl->set( 'specialpageattributes', $attrs );
-                       }
                }
 
                $newtalks = $this->getNewtalks( $out );
@@ -454,19 +449,18 @@ class SkinTemplate extends Skin {
                $tpl->set( 'bottomscripts', $this->bottomScripts( $out ) );
                $tpl->set( 'printfooter', $this->printSource() );
 
-               global $wgBetterDirectionality;
-               if ( $wgBetterDirectionality ) {
-                       // 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( !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();
-                               $realBodyAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
-                                       'class' => 'mw-content-'.$pageLang->getDir() );
-                               $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext );
-                       }
+               # Add a <div class="mw-content-ltr/rtl"> around the body text
+               # 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( !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();
+                       $realBodyAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
+                               'class' => 'mw-content-'.$pageLang->getDir() );
+                       $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext );
                }
+
                $tpl->setRef( 'bodytext', $out->mBodytext );
 
                # Language links
index a96184c..d6c4109 100644 (file)
@@ -934,14 +934,10 @@ CONTROL;
         * @return string
         */
        function addHeader( $diff, $otitle, $ntitle, $multi = '', $notice = '' ) {
-               global $wgBetterDirectionality;
-               $tableClass = 'diff';
-               if( $wgBetterDirectionality ) {
-                       // shared.css sets diff in interface language/dir,
-                       // but the actual content should be in the page language/dir
-                       $pageLang = $this->mTitle->getPageLanguage();
-                       $tableClass .= ' diff-contentalign-' . htmlspecialchars( $pageLang->alignStart() );
-               }
+               // shared.css sets diff in interface language/dir,
+               // but the actual content should be in the page language/dir
+               $pageLang = $this->mTitle->getPageLanguage();
+               $tableClass = 'diff diff-contentalign-' . htmlspecialchars( $pageLang->alignStart() );
                $header = "<table class='$tableClass'>";
                if ( $diff ) { // Safari/Chrome show broken output if cols not used
                        $header .= "
index d391f63..05ab434 100644 (file)
@@ -140,11 +140,8 @@ class ResourceLoaderContext {
                if ( $this->direction === null ) {
                        $this->direction = $this->request->getVal( 'dir' );
                        if ( !$this->direction ) {
-                               global $wgBetterDirectionality, $wgContLang;
-                               // if $wgBetterDirectionality is true, set
-                               // directionality based on user language (see bug 6100)
-                               $this->direction = ( $wgBetterDirectionality ?
-                                       Language::factory( $this->language )->getDir() : $wgContLang->getDir() );
+                               # directionality based on user language (see bug 6100)
+                               $this->direction = Language::factory( $this->language )->getDir();
                        }
                }
                return $this->direction;
index 316aaec..0c01913 100644 (file)
@@ -411,8 +411,7 @@ class AllmessagesTablePager extends TablePager {
        }
 
        function getCellAttrs( $field, $value ){
-               global $wgBetterDirectionality;
-               if( $field != 'am_title' && $wgBetterDirectionality ) {
+               if( $field != 'am_title' ) {
                        return array( 'lang' => $this->langcode, 'dir' => $this->lang->getDir() );
                } elseif( $this->mCurrentRow->am_customised && $field == 'am_title' ) {
                        return array( 'rowspan' => '2', 'class' => $field );
index 1ea25ae..21a098a 100644 (file)
@@ -116,7 +116,7 @@ class BrokenRedirectsPage extends PageQueryPage {
                        array(),
                        array( 'broken' )
                );
-               $arr = wfUILang()->getArrow();
+               $arr = $wgLang->getArrow();
 
                $out = $from . wfMsg( 'word-separator' );
 
index fb89776..6a0ff31 100644 (file)
@@ -627,7 +627,7 @@ class ContribsPager extends ReverseChronologicalPager {
                        array( 'action' => 'history' )
                );
 
-               $comment = wfUILang()->getDirMark() . $sk->revComment( $rev, false, true );
+               $comment = $wgLang->getDirMark() . $sk->revComment( $rev, false, true );
                $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
                if( $rev->userCan( Revision::DELETED_TEXT ) ) {
                        $d = $sk->linkKnown(
@@ -684,7 +684,7 @@ class ContribsPager extends ReverseChronologicalPager {
                $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')';
 
 
-               $diffOut = ' . . ' . wfUILang()->getDirMark() . ( $this->showSizeDiff ?
+               $diffOut = ' . . ' . $wgLang->getDirMark() . ( $this->showSizeDiff ?
                        ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len ) : Linker::formatRevisionSize( $row->rev_len ) );
 
                $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$diffOut}{$userlink} {$comment} {$topmarktext}";
index bcea5d4..431dfe7 100644 (file)
@@ -122,13 +122,15 @@ class DisambiguationsPage extends PageQueryPage {
        }
 
        function formatResult( $skin, $result ) {
+               global $wgLang;
+
                $title = Title::newFromID( $result->value );
                $dp = Title::makeTitle( $result->namespace, $result->title );
 
                $from = $skin->link( $title );
                $edit = $skin->link( $title, wfMsgExt( 'parentheses', array( 'escape' ), wfMsg( 'editlink' ) ) ,
                        array(), array( 'redirect' => 'no', 'action' => 'edit' ) );
-               $arr  = wfUILang()->getArrow();
+               $arr  = $wgLang->getArrow();
                $to   = $skin->link( $dp );
 
                return "$from $edit $arr $to";
index 56d5ded..ec899d8 100644 (file)
@@ -76,6 +76,8 @@ class DoubleRedirectsPage extends PageQueryPage {
        }
 
        function formatResult( $skin, $result ) {
+               global $wgLang;
+
                $titleA = Title::makeTitle( $result->namespace, $result->title );
 
                if ( $result && !isset( $result->nsb ) ) {
@@ -117,7 +119,7 @@ class DoubleRedirectsPage extends PageQueryPage {
                        array( 'redirect' => 'no' )
                );
                $linkC = $skin->linkKnown( $titleC );
-               $arr = wfUILang()->getArrow() . wfUILang()->getDirMark();
+               $arr = $wgLang->getArrow() . $wgLang->getDirMark();
 
                return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" );
        }
index be65581..977c65e 100644 (file)
@@ -126,14 +126,12 @@ class FileDuplicateSearchPage extends QueryPage {
                }
 
                if( $this->hash != '' ) {
-                       $align = wfUILang()->alignEnd();
-
                        # Show a thumbnail of the file
                        $img = $this->file;
                        if ( $img ) {
                                $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
                                if( $thumb ) {
-                                       $wgOut->addHTML( '<div style="float:' . $align . '" id="mw-fileduplicatesearch-icon">' .
+                                       $wgOut->addHTML( '<div class="mw-float-end" id="mw-fileduplicatesearch-icon">' .
                                                $thumb->toHtml( array( 'desc-link' => false ) ) . '<br />' .
                                                wfMsgExt( 'fileduplicatesearch-info', array( 'parse' ),
                                                        $wgLang->formatNum( $img->getWidth() ),
index 8552717..acf5fbd 100644 (file)
@@ -108,8 +108,9 @@ class ListredirectsPage extends QueryPage {
                # Find out where the redirect leads
                $target = $this->getRedirectTarget( $result );
                if( $target ) {
+                       global $wgLang;
                        # Make a link to the destination page
-                       $arr = wfUILang()->getArrow() . wfUILang()->getDirMark();
+                       $arr = $wgLang->getArrow() . $wgLang->getDirMark();
                        $targetLink = $skin->link( $target );
                        return "$rd_link $arr $targetLink";
                } else {
index a86b9a4..bf9fb9f 100644 (file)
@@ -302,7 +302,7 @@ class SpecialNewpages extends IncludableSpecialPage {
 
                $classes = array();
 
-               $dm = wfUILang()->getDirMark();
+               $dm = $wgLang->getDirMark();
 
                $title = Title::makeTitleSafe( $result->rc_namespace, $result->rc_title );
                $time = Html::element( 'span', array( 'class' => 'mw-newpages-time' ),
index f6decfc..b1f61f0 100644 (file)
@@ -116,7 +116,7 @@ class SpecialProtectedpages extends SpecialPage {
                }
 
                if(!is_null($size = $row->page_len)) {
-                       $stxt = wfUILang()->getDirMark() . ' ' . $skin->formatRevisionSize( $size );
+                       $stxt = $wgLang->getDirMark() . ' ' . $skin->formatRevisionSize( $size );
                }
 
                # Show a link to the change protection form for allowed users otherwise a link to the protection log
@@ -145,7 +145,7 @@ class SpecialProtectedpages extends SpecialPage {
                return Html::rawElement(
                        'li',
                        array(),
-                       wfSpecialList( $link . $stxt, $wgLang->commaList( $description_items ) ) . $changeProtection ) . "\n";
+                       wfSpecialList( $link . $stxt, $wgLang->commaList( $description_items ), false ) . $changeProtection ) . "\n";
        }
 
        /**
index 1f71843..3b78501 100644 (file)
@@ -87,7 +87,7 @@ class ShortPagesPage extends QueryPage {
 
        function formatResult( $skin, $result ) {
                global $wgLang;
-               $dm = wfUILang()->getDirMark();
+               $dm = $wgLang->getDirMark();
 
                $title = Title::makeTitle( $result->namespace, $result->title );
                if ( !$title ) {
index 078677e..5cdaad6 100644 (file)
@@ -268,6 +268,9 @@ class SpecialWhatLinksHere extends SpecialPage {
        }
 
        protected function listItem( $row, $nt, $notClose = false ) {
+               global $wgLang;
+               $dirmark = $wgLang->getDirMark();
+
                # local message cache
                static $msgcache = null;
                if ( $msgcache === null ) {
@@ -310,7 +313,6 @@ class SpecialWhatLinksHere extends SpecialPage {
                $wlhLink = $this->wlhLink( $nt, $msgcache['whatlinkshere-links'] );
                $wlh = Xml::wrapClass( "($wlhLink)", 'mw-whatlinkshere-tools' );
 
-               $dirmark = wfUILang()->getDirMark();
                return $notClose ?
                        Xml::openElement( 'li' ) . "$link $propsText $dirmark $wlh\n" :
                        Xml::tags( 'li', null, "$link $propsText $dirmark $wlh" ) . "\n";
index a7795a4..80faca2 100644 (file)
@@ -2351,10 +2351,14 @@ class Language {
        /**
         * A hidden direction mark (LRM or RLM), depending on the language direction
         *
+        * @param $opposite Boolean Get the direction mark opposite to your language
         * @return string
         */
-       function getDirMark() {
-               return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E";
+       function getDirMark( $opposite = false ) {
+               $rtl = "\xE2\x80\x8F";
+               $ltr = "\xE2\x80\x8E";
+               if( $opposite ) { return $this->isRTL() ? $ltr : $rtl; }
+               return $this->isRTL() ? $rtl : $ltr;
        }
 
        /**
index d0646c6..02e3b0a 100644 (file)
@@ -70,7 +70,7 @@ class ModernTemplate extends MonoBookTemplate {
        <!-- contentholder does nothing by default, but it allows users to style the text inside
             the content area without affecting the meaning of 'em' in #mw_content, which is used
             for the margins -->
-       <div id="mw_contentholder" <?php $this->html("specialpageattributes") ?>>
+       <div id="mw_contentholder">
                <div class='mw-topboxes'>
                        <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes')?>></div>
                        <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
index 76a21ef..472bbf3 100644 (file)
@@ -77,7 +77,7 @@ class MonoBookTemplate extends BaseTemplate {
 
                $this->html( 'headelement' );
 ?><div id="globalWrapper">
-<div id="column-content"><div id="content"<?php $this->html("specialpageattributes") ?>>
+<div id="column-content"><div id="content">
        <a id="top"></a>
        <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
 
index c4def54..e0d87a8 100644 (file)
@@ -135,7 +135,7 @@ class VectorTemplate extends BaseTemplate {
                <div id="mw-page-base" class="noprint"></div>
                <div id="mw-head-base" class="noprint"></div>
                <!-- content -->
-               <div id="content"<?php $this->html( 'specialpageattributes' ) ?>>
+               <div id="content">
                        <a id="top"></a>
                        <div id="mw-js-message" style="display:none;"<?php $this->html( 'userlangattributes' ) ?>></div>
                        <?php if ( $this->data['sitenotice'] ): ?>
@@ -336,14 +336,14 @@ class VectorTemplate extends BaseTemplate {
         * @param $elements array
         */
        private function renderNavigation( $elements ) {
-               global $wgVectorUseSimpleSearch, $wgVectorShowVariantName, $wgUser;
+               global $wgVectorUseSimpleSearch, $wgVectorShowVariantName, $wgUser, $wgLang;
 
                // If only one element was given, wrap it in an array, allowing more
                // flexible arguments
                if ( !is_array( $elements ) ) {
                        $elements = array( $elements );
                // If there's a series of elements, reverse them when in RTL mode
-               } elseif ( wfUILang()->isRTL() ) {
+               } elseif ( $wgLang->isRTL() ) {
                        $elements = array_reverse( $elements );
                }
                // Render elements
index 26e404c..77dad1e 100644 (file)
@@ -4,6 +4,23 @@
  * another, but don't ignore the poor pre-Monobook users either.
  */
 
+/* GENERAL CLASSES FOR DIRECTIONALITY SUPPORT */
+/* These classes should be used for text depending on the content direction.
+Content stuff like editsection, ul/ol and TOC depend on this. */
+ /* @noflip */.mw-content-ltr { direction: ltr; }
+/* @noflip */.mw-content-rtl { direction: rtl; }
+/* Most input fields should be in site direction */
+/* @noflip */.sitedir-ltr textarea, .sitedir-ltr input { direction: ltr; }
+/* @noflip */.sitedir-rtl textarea, .sitedir-rtl input { direction: rtl; }
+/* Input types that should follow user direction, like buttons */
+input[type="submit"], input[type="button"], input[type="reset"], input[type="file"] { direction: ltr; }
+/* Override default values */
+/* @noflip */textarea[dir="ltr"], input[dir="ltr"] { direction: ltr; }
+/* @noflip */textarea[dir="rtl"], input[dir="rtl"] { direction: rtl; }
+
+.mw-float-start { float: left; }
+.mw-float-end { float: right; }
+
 /* The scripts of these languages are very hard to read with underlines */
 [lang="ar"] a, [lang="ckb"] a, [lang="fa"] a, [lang="kk-arab"] a,
 [lang="mzn"] a, [lang="ps"] a, [lang="ur"] a {
@@ -69,8 +86,8 @@ div#mw-js-message {
        margin-left: 5px;
 }
 /* Correct directionality when page dir is different from site/user dir */
-/* @noflip */div#content [dir="ltr"] .editsection, div#content [dir="rtl"] [dir="ltr"] .editsection { float: right; }
-/* @noflip */div#content [dir="rtl"] .editsection, div#content [dir="ltr"] [dir="rtl"] .editsection { float: left; }
+/* @noflip */.mw-content-ltr .editsection, .mw-content-rtl .mw-content-ltr .editsection { float: right; }
+/* @noflip */.mw-content-rtl .editsection, .mw-content-ltr .mw-content-rtl .editsection { float: left; }
 /**
  * File histories
  */
@@ -625,12 +642,12 @@ div.gallerytext {
 }
 
 /* Correct directionality when page dir is different from site/user dir */
-/* @noflip */div#content [dir="ltr"] ul, div#content [dir="ltr"] ol,
-div#content [dir="rtl"] [dir="ltr"] ul, div#content [dir="rtl"] [dir="ltr"] ol {
+/* @noflip */.mw-content-ltr ul, .mw-content-ltr ol,
+.mw-content-rtl .mw-content-ltr ul, .mw-content-rtl .mw-content-ltr ol {
        margin: .3em 0 0 1.5em;
 }
-/* @noflip */div#content [dir="rtl"] ul, div#content [dir="rtl"] ol,
-div#content [dir="ltr"] [dir="rtl"] ul, div#content [dir="ltr"] [dir="rtl"] ol {
+/* @noflip */.mw-content-rtl ul, .mw-content-rtl ol,
+.mw-content-ltr .mw-content-rtl ul, .mw-content-ltr .mw-content-rtl ol {
        margin: .3em 1.5em 0 0;
 }
 /* Localised ordered list numbering for some languages */
@@ -660,22 +677,22 @@ ol:lang(or) li {
 }
 
 /* Correct directionality when page dir is different from site/user dir */
-/* @noflip */div#content [dir="ltr"] .toc ul, div#content [dir="ltr"] #toc ul,
-div#content [dir="rtl"] [dir="ltr"] .toc ul, div#content [dir="rtl"] [dir="ltr"] #toc ul {
+/* @noflip */.mw-content-ltr .toc ul, .mw-content-ltr #toc ul,
+.mw-content-rtl .mw-content-ltr .toc ul, .mw-content-rtl .mw-content-ltr #toc ul {
        text-align: left;
        margin-left: 0;
 }
-/* @noflip */div#content [dir="rtl"] .toc ul, div#content [dir="rtl"] #toc ul,
-div#content [dir="ltr"] [dir="rtl"] .toc ul, div#content [dir="ltr"] [dir="rtl"] #toc ul {
+/* @noflip */.mw-content-rtl .toc ul, .mw-content-rtl #toc ul,
+.mw-content-ltr .mw-content-rtl .toc ul, .mw-content-ltr .mw-content-rtl #toc ul {
        text-align: right;
        margin-right: 0;
 }
-/* @noflip */div#content [dir="ltr"] .toc ul ul, div#content [dir="ltr"] #toc ul ul,
-div#content [dir="rtl"] [dir="ltr"] .toc ul ul, div#content [dir="rtl"] [dir="ltr"] #toc ul ul {
+/* @noflip */.mw-content-ltr .toc ul ul, .mw-content-ltr #toc ul ul,
+.mw-content-rtl .mw-content-ltr .toc ul ul, .mw-content-rtl .mw-content-ltr #toc ul ul {
        margin: 0 0 0 2em;
 }
-/* @noflip */div#content [dir="rtl"] .toc ul ul, div#content [dir="rtl"] #toc ul ul,
-div#content [dir="ltr"] [dir="rtl"] .toc ul ul, div#content [dir="ltr"] [dir="rtl"] #toc ul ul {
+/* @noflip */.mw-content-rtl .toc ul ul, .mw-content-rtl #toc ul ul,
+.mw-content-ltr .mw-content-rtl .toc ul ul, .mw-content-ltr .mw-content-rtl #toc ul ul {
        margin: 0 2em 0 0;
 }