Index: trunk/phase3/languages/Language.php |
— | — | @@ -2351,10 +2351,14 @@ |
2352 | 2352 | /** |
2353 | 2353 | * A hidden direction mark (LRM or RLM), depending on the language direction |
2354 | 2354 | * |
| 2355 | + * @param $opposite Boolean Get the direction mark opposite to your language |
2355 | 2356 | * @return string |
2356 | 2357 | */ |
2357 | | - function getDirMark() { |
2358 | | - return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E"; |
| 2358 | + function getDirMark( $opposite = false ) { |
| 2359 | + $rtl = "\xE2\x80\x8F"; |
| 2360 | + $ltr = "\xE2\x80\x8E"; |
| 2361 | + if( $opposite ) { return $this->isRTL() ? $ltr : $rtl; } |
| 2362 | + return $this->isRTL() ? $rtl : $ltr; |
2359 | 2363 | } |
2360 | 2364 | |
2361 | 2365 | /** |
Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -4,6 +4,23 @@ |
5 | 5 | * another, but don't ignore the poor pre-Monobook users either. |
6 | 6 | */ |
7 | 7 | |
| 8 | +/* GENERAL CLASSES FOR DIRECTIONALITY SUPPORT */ |
| 9 | +/* These classes should be used for text depending on the content direction. |
| 10 | +Content stuff like editsection, ul/ol and TOC depend on this. */ |
| 11 | + /* @noflip */.mw-content-ltr { direction: ltr; } |
| 12 | +/* @noflip */.mw-content-rtl { direction: rtl; } |
| 13 | +/* Most input fields should be in site direction */ |
| 14 | +/* @noflip */.sitedir-ltr textarea, .sitedir-ltr input { direction: ltr; } |
| 15 | +/* @noflip */.sitedir-rtl textarea, .sitedir-rtl input { direction: rtl; } |
| 16 | +/* Input types that should follow user direction, like buttons */ |
| 17 | +input[type="submit"], input[type="button"], input[type="reset"], input[type="file"] { direction: ltr; } |
| 18 | +/* Override default values */ |
| 19 | +/* @noflip */textarea[dir="ltr"], input[dir="ltr"] { direction: ltr; } |
| 20 | +/* @noflip */textarea[dir="rtl"], input[dir="rtl"] { direction: rtl; } |
| 21 | + |
| 22 | +.mw-float-start { float: left; } |
| 23 | +.mw-float-end { float: right; } |
| 24 | + |
8 | 25 | /* The scripts of these languages are very hard to read with underlines */ |
9 | 26 | [lang="ar"] a, [lang="ckb"] a, [lang="fa"] a, [lang="kk-arab"] a, |
10 | 27 | [lang="mzn"] a, [lang="ps"] a, [lang="ur"] a { |
— | — | @@ -69,8 +86,8 @@ |
70 | 87 | margin-left: 5px; |
71 | 88 | } |
72 | 89 | /* Correct directionality when page dir is different from site/user dir */ |
73 | | -/* @noflip */div#content [dir="ltr"] .editsection, div#content [dir="rtl"] [dir="ltr"] .editsection { float: right; } |
74 | | -/* @noflip */div#content [dir="rtl"] .editsection, div#content [dir="ltr"] [dir="rtl"] .editsection { float: left; } |
| 90 | +/* @noflip */.mw-content-ltr .editsection, .mw-content-rtl .mw-content-ltr .editsection { float: right; } |
| 91 | +/* @noflip */.mw-content-rtl .editsection, .mw-content-ltr .mw-content-rtl .editsection { float: left; } |
75 | 92 | /** |
76 | 93 | * File histories |
77 | 94 | */ |
— | — | @@ -625,12 +642,12 @@ |
626 | 643 | } |
627 | 644 | |
628 | 645 | /* Correct directionality when page dir is different from site/user dir */ |
629 | | -/* @noflip */div#content [dir="ltr"] ul, div#content [dir="ltr"] ol, |
630 | | -div#content [dir="rtl"] [dir="ltr"] ul, div#content [dir="rtl"] [dir="ltr"] ol { |
| 646 | +/* @noflip */.mw-content-ltr ul, .mw-content-ltr ol, |
| 647 | +.mw-content-rtl .mw-content-ltr ul, .mw-content-rtl .mw-content-ltr ol { |
631 | 648 | margin: .3em 0 0 1.5em; |
632 | 649 | } |
633 | | -/* @noflip */div#content [dir="rtl"] ul, div#content [dir="rtl"] ol, |
634 | | -div#content [dir="ltr"] [dir="rtl"] ul, div#content [dir="ltr"] [dir="rtl"] ol { |
| 650 | +/* @noflip */.mw-content-rtl ul, .mw-content-rtl ol, |
| 651 | +.mw-content-ltr .mw-content-rtl ul, .mw-content-ltr .mw-content-rtl ol { |
635 | 652 | margin: .3em 1.5em 0 0; |
636 | 653 | } |
637 | 654 | /* Localised ordered list numbering for some languages */ |
— | — | @@ -660,22 +677,22 @@ |
661 | 678 | } |
662 | 679 | |
663 | 680 | /* Correct directionality when page dir is different from site/user dir */ |
664 | | -/* @noflip */div#content [dir="ltr"] .toc ul, div#content [dir="ltr"] #toc ul, |
665 | | -div#content [dir="rtl"] [dir="ltr"] .toc ul, div#content [dir="rtl"] [dir="ltr"] #toc ul { |
| 681 | +/* @noflip */.mw-content-ltr .toc ul, .mw-content-ltr #toc ul, |
| 682 | +.mw-content-rtl .mw-content-ltr .toc ul, .mw-content-rtl .mw-content-ltr #toc ul { |
666 | 683 | text-align: left; |
667 | 684 | margin-left: 0; |
668 | 685 | } |
669 | | -/* @noflip */div#content [dir="rtl"] .toc ul, div#content [dir="rtl"] #toc ul, |
670 | | -div#content [dir="ltr"] [dir="rtl"] .toc ul, div#content [dir="ltr"] [dir="rtl"] #toc ul { |
| 686 | +/* @noflip */.mw-content-rtl .toc ul, .mw-content-rtl #toc ul, |
| 687 | +.mw-content-ltr .mw-content-rtl .toc ul, .mw-content-ltr .mw-content-rtl #toc ul { |
671 | 688 | text-align: right; |
672 | 689 | margin-right: 0; |
673 | 690 | } |
674 | | -/* @noflip */div#content [dir="ltr"] .toc ul ul, div#content [dir="ltr"] #toc ul ul, |
675 | | -div#content [dir="rtl"] [dir="ltr"] .toc ul ul, div#content [dir="rtl"] [dir="ltr"] #toc ul ul { |
| 691 | +/* @noflip */.mw-content-ltr .toc ul ul, .mw-content-ltr #toc ul ul, |
| 692 | +.mw-content-rtl .mw-content-ltr .toc ul ul, .mw-content-rtl .mw-content-ltr #toc ul ul { |
676 | 693 | margin: 0 0 0 2em; |
677 | 694 | } |
678 | | -/* @noflip */div#content [dir="rtl"] .toc ul ul, div#content [dir="rtl"] #toc ul ul, |
679 | | -div#content [dir="ltr"] [dir="rtl"] .toc ul ul, div#content [dir="ltr"] [dir="rtl"] #toc ul ul { |
| 695 | +/* @noflip */.mw-content-rtl .toc ul ul, .mw-content-rtl #toc ul ul, |
| 696 | +.mw-content-ltr .mw-content-rtl .toc ul ul, .mw-content-ltr .mw-content-rtl #toc ul ul { |
680 | 697 | margin: 0 2em 0 0; |
681 | 698 | } |
682 | 699 | |
Index: trunk/phase3/skins/Vector.php |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | <div id="mw-page-base" class="noprint"></div> |
137 | 137 | <div id="mw-head-base" class="noprint"></div> |
138 | 138 | <!-- content --> |
139 | | - <div id="content"<?php $this->html( 'specialpageattributes' ) ?>> |
| 139 | + <div id="content"> |
140 | 140 | <a id="top"></a> |
141 | 141 | <div id="mw-js-message" style="display:none;"<?php $this->html( 'userlangattributes' ) ?>></div> |
142 | 142 | <?php if ( $this->data['sitenotice'] ): ?> |
— | — | @@ -336,14 +336,14 @@ |
337 | 337 | * @param $elements array |
338 | 338 | */ |
339 | 339 | private function renderNavigation( $elements ) { |
340 | | - global $wgVectorUseSimpleSearch, $wgVectorShowVariantName, $wgUser; |
| 340 | + global $wgVectorUseSimpleSearch, $wgVectorShowVariantName, $wgUser, $wgLang; |
341 | 341 | |
342 | 342 | // If only one element was given, wrap it in an array, allowing more |
343 | 343 | // flexible arguments |
344 | 344 | if ( !is_array( $elements ) ) { |
345 | 345 | $elements = array( $elements ); |
346 | 346 | // If there's a series of elements, reverse them when in RTL mode |
347 | | - } elseif ( wfUILang()->isRTL() ) { |
| 347 | + } elseif ( $wgLang->isRTL() ) { |
348 | 348 | $elements = array_reverse( $elements ); |
349 | 349 | } |
350 | 350 | // Render elements |
Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | |
79 | 79 | $this->html( 'headelement' ); |
80 | 80 | ?><div id="globalWrapper"> |
81 | | -<div id="column-content"><div id="content"<?php $this->html("specialpageattributes") ?>> |
| 81 | +<div id="column-content"><div id="content"> |
82 | 82 | <a id="top"></a> |
83 | 83 | <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?> |
84 | 84 | |
Index: trunk/phase3/skins/Modern.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | <!-- contentholder does nothing by default, but it allows users to style the text inside |
72 | 72 | the content area without affecting the meaning of 'em' in #mw_content, which is used |
73 | 73 | for the margins --> |
74 | | - <div id="mw_contentholder" <?php $this->html("specialpageattributes") ?>> |
| 74 | + <div id="mw_contentholder"> |
75 | 75 | <div class='mw-topboxes'> |
76 | 76 | <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes')?>></div> |
77 | 77 | <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div> |
Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -139,8 +139,8 @@ |
140 | 140 | * Make sure Backlink cache does not retrieve interwiki redirects when looking for |
141 | 141 | redirects to a local page. |
142 | 142 | * (bug 6100) Allow different directionality (LTR/RTL) for user interface |
143 | | - and wiki content, when $wgBetterDirectionality is enabled, along with |
144 | | - many RTL improvements (such as bugs 28030, 12406, 28349) |
| 143 | + and wiki content, along with many other RTL and directionality improvements |
| 144 | + (such as bugs 28030, 12406, 28349) |
145 | 145 | * (bug 29712) Removed broken defaultUserOptionOverrides in MessagesXx files and |
146 | 146 | unneeded CSS flipping of quickbar. Instead, introduce option 5 which sets |
147 | 147 | left/right according to the directionality of your interface language. |
Index: trunk/phase3/includes/HistoryPage.php |
— | — | @@ -410,15 +410,13 @@ |
411 | 411 | |
412 | 412 | private function getRevisionButton( $name, $msg ) { |
413 | 413 | $this->preventClickjacking(); |
414 | | - $float = wfUILang()->alignEnd(); |
415 | 414 | # Note bug #20966, <button> is non-standard in IE<8 |
416 | 415 | $element = Html::element( 'button', |
417 | 416 | array( |
418 | 417 | 'type' => 'submit', |
419 | 418 | 'name' => $name, |
420 | 419 | 'value' => '1', |
421 | | - 'style' => "float: $float;", |
422 | | - 'class' => "mw-history-$name-button", |
| 420 | + 'class' => "mw-history-$name-button mw-float-end", |
423 | 421 | ), |
424 | 422 | wfMsg( $msg ) |
425 | 423 | ) . "\n"; |
— | — | @@ -533,7 +531,7 @@ |
534 | 532 | $s .= " $del "; |
535 | 533 | } |
536 | 534 | |
537 | | - $dirmark = wfUILang()->getDirMark(); |
| 535 | + $dirmark = $wgLang->getDirMark(); |
538 | 536 | |
539 | 537 | $s .= " $link"; |
540 | 538 | $s .= $dirmark; |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -1814,12 +1814,9 @@ |
1815 | 1815 | 'style' => '' // avoid php notices when appending preferences (appending allows customAttribs['style'] to still work |
1816 | 1816 | ); |
1817 | 1817 | |
1818 | | - global $wgBetterDirectionality; |
1819 | | - if( $wgBetterDirectionality ) { |
1820 | | - $pageLang = $this->mTitle->getPageLanguage(); |
1821 | | - $attribs['lang'] = $pageLang->getCode(); |
1822 | | - $attribs['dir'] = $pageLang->getDir(); |
1823 | | - } |
| 1818 | + $pageLang = $this->mTitle->getPageLanguage(); |
| 1819 | + $attribs['lang'] = $pageLang->getCode(); |
| 1820 | + $attribs['dir'] = $pageLang->getDir(); |
1824 | 1821 | |
1825 | 1822 | $wgOut->addHTML( Html::textarea( $name, $wikitext, $attribs ) ); |
1826 | 1823 | } |
— | — | @@ -2095,13 +2092,11 @@ |
2096 | 2093 | '<h2 id="mw-previewheader">' . htmlspecialchars( wfMsg( 'preview' ) ) . "</h2>" . |
2097 | 2094 | $wgOut->parse( $note ) . $conflict . "</div>\n"; |
2098 | 2095 | |
2099 | | - global $wgBetterDirectionality; |
2100 | | - if( $wgBetterDirectionality ) { |
2101 | | - $pageLang = $this->mTitle->getPageLanguage(); |
2102 | | - $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(), |
2103 | | - 'class' => 'mw-content-'.$pageLang->getDir() ); |
2104 | | - $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML ); |
2105 | | - } |
| 2096 | + $pageLang = $this->mTitle->getPageLanguage(); |
| 2097 | + $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(), |
| 2098 | + 'class' => 'mw-content-'.$pageLang->getDir() ); |
| 2099 | + $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML ); |
| 2100 | + |
2106 | 2101 | wfProfileOut( __METHOD__ ); |
2107 | 2102 | return $previewhead . $previewHTML . $this->previewTextAfterContent; |
2108 | 2103 | } |
Index: trunk/phase3/includes/ChangesList.php |
— | — | @@ -323,6 +323,7 @@ |
324 | 324 | * @return void |
325 | 325 | */ |
326 | 326 | public function insertArticleLink( &$s, &$rc, $unpatrolled, $watched ) { |
| 327 | + global $wgLang; |
327 | 328 | # If it's a new article, there is no diff link, but if it hasn't been |
328 | 329 | # patrolled yet, we need to give users a way to do so |
329 | 330 | $params = array(); |
— | — | @@ -354,7 +355,7 @@ |
355 | 356 | $articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>"; |
356 | 357 | } |
357 | 358 | # RTL/LTR marker |
358 | | - $articlelink .= wfUILang()->getDirMark(); |
| 359 | + $articlelink .= $wgLang->getDirMark(); |
359 | 360 | |
360 | 361 | wfRunHooks( 'ChangesListInsertArticleLink', |
361 | 362 | array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched) ); |
— | — | @@ -590,7 +591,7 @@ |
591 | 592 | # User tool links |
592 | 593 | $this->insertUserRelatedLinks( $s, $rc ); |
593 | 594 | # LTR/RTL direction mark |
594 | | - $s .= wfUILang()->getDirMark(); |
| 595 | + $s .= $wgLang->getDirMark(); |
595 | 596 | # Log action text (if any) |
596 | 597 | $this->insertAction( $s, $rc ); |
597 | 598 | # Edit or log comment |
— | — | @@ -868,7 +869,7 @@ |
869 | 870 | $users = array(); |
870 | 871 | foreach( $userlinks as $userlink => $count) { |
871 | 872 | $text = $userlink; |
872 | | - $text .= wfUILang()->getDirMark(); |
| 873 | + $text .= $wgLang->getDirMark(); |
873 | 874 | if( $count > 1 ) { |
874 | 875 | $text .= ' (' . $wgLang->formatNum( $count ) . '×)'; |
875 | 876 | } |
— | — | @@ -910,7 +911,7 @@ |
911 | 912 | $this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched ); |
912 | 913 | } |
913 | 914 | |
914 | | - $r .= wfUILang()->getDirMark(); |
| 915 | + $r .= $wgLang->getDirMark(); |
915 | 916 | |
916 | 917 | $queryParams['curid'] = $curId; |
917 | 918 | # Changes message |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -1043,13 +1043,13 @@ |
1044 | 1044 | * @return string containing HMTL with redirect link |
1045 | 1045 | */ |
1046 | 1046 | public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) { |
1047 | | - global $wgOut, $wgStylePath; |
| 1047 | + global $wgOut, $wgLang, $wgStylePath; |
1048 | 1048 | |
1049 | 1049 | if ( !is_array( $target ) ) { |
1050 | 1050 | $target = array( $target ); |
1051 | 1051 | } |
1052 | 1052 | |
1053 | | - $imageDir = wfUILang()->getDir(); |
| 1053 | + $imageDir = $wgLang->getDir(); |
1054 | 1054 | |
1055 | 1055 | if ( $appendSubtitle ) { |
1056 | 1056 | $wgOut->appendSubtitle( wfMsgHtml( 'redirectpagesub' ) ); |
— | — | @@ -1065,7 +1065,7 @@ |
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | $nextRedirect = $wgStylePath . '/common/images/nextredirect' . $imageDir . '.png'; |
1069 | | - $alt = wfUILang()->isRTL() ? '←' : '→'; |
| 1069 | + $alt = $wgLang->isRTL() ? '←' : '→'; |
1070 | 1070 | // Automatically append redirect=no to each link, since most of them are redirect pages themselves. |
1071 | 1071 | foreach ( $target as $rt ) { |
1072 | 1072 | $link .= Html::element( 'img', array( 'src' => $nextRedirect, 'alt' => $alt ) ); |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -910,17 +910,15 @@ |
911 | 911 | } |
912 | 912 | |
913 | 913 | /** |
914 | | - * Use this instead of $wgContLang, when working with user interface. |
915 | | - * User interface is currently hard coded according to wiki content language |
916 | | - * in many ways, especially regarding to text direction. There is lots stuff |
917 | | - * to fix, hence this function to keep the old behaviour unless the global |
918 | | - * $wgBetterDirectionality is enabled (or removed when everything works). |
| 914 | + * Old function when $wgBetterDirectionality existed |
| 915 | + * Removed in core, kept in extensions for backwards compat. |
919 | 916 | * |
| 917 | + * @deprecated since 1.19 |
920 | 918 | * @return Language |
921 | 919 | */ |
922 | 920 | function wfUILang() { |
923 | | - global $wgBetterDirectionality; |
924 | | - return wfGetLangObj( !$wgBetterDirectionality ); |
| 921 | + global $wgLang; |
| 922 | + return $wgLang; |
925 | 923 | } |
926 | 924 | |
927 | 925 | /** |
— | — | @@ -2542,8 +2540,20 @@ |
2543 | 2541 | return $func( $str, $needle ) !== false; |
2544 | 2542 | } |
2545 | 2543 | |
2546 | | -function wfSpecialList( $page, $details ) { |
2547 | | - $details = $details ? ' ' . wfUILang()->getDirMark() . "($details)" : ''; |
| 2544 | +/** |
| 2545 | + * Make a list item, used by various special pages |
| 2546 | + * |
| 2547 | + * @param $page String Page link |
| 2548 | + * @param $details String Text between brackets |
| 2549 | + * @param $oppositedm Boolean Add the direction mark opposite to your |
| 2550 | + * language, to display text properly |
| 2551 | + * @return String |
| 2552 | + */ |
| 2553 | +function wfSpecialList( $page, $details, $oppositedm = true ) { |
| 2554 | + global $wgLang; |
| 2555 | + $dirmark = ( $oppositedm ? $wgLang->getDirMark( true ) : '' ) . |
| 2556 | + $wgLang->getDirMark(); |
| 2557 | + $details = $details ? $dirmark . "($details)" : ''; |
2548 | 2558 | return $page . $details; |
2549 | 2559 | } |
2550 | 2560 | |
Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -368,7 +368,8 @@ |
369 | 369 | $comment = '<span class="history-deleted">' . |
370 | 370 | wfMsgHtml( 'rev-deleted-comment' ) . '</span>'; |
371 | 371 | } else { |
372 | | - $comment = wfUILang()->getDirMark() . |
| 372 | + global $wgLang; |
| 373 | + $comment = $wgLang->getDirMark() . |
373 | 374 | $this->skin->commentBlock( $row->log_comment ); |
374 | 375 | } |
375 | 376 | return $comment; |
Index: trunk/phase3/includes/CategoryPage.php |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | * @return string HTML output |
145 | 145 | */ |
146 | 146 | public function getHTML() { |
147 | | - global $wgOut, $wgCategoryMagicGallery, $wgContLang, $wgBetterDirectionality; |
| 147 | + global $wgOut, $wgCategoryMagicGallery, $wgContLang; |
148 | 148 | wfProfileIn( __METHOD__ ); |
149 | 149 | |
150 | 150 | $this->showGallery = $wgCategoryMagicGallery && !$wgOut->mNoGallery; |
— | — | @@ -174,13 +174,11 @@ |
175 | 175 | $r = wfMsgExt( 'category-empty', array( 'parse' ) ); |
176 | 176 | } |
177 | 177 | |
178 | | - if( $wgBetterDirectionality ) { |
179 | | - $pageLang = $this->title->getPageLanguage(); |
180 | | - $langAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() ); |
181 | | - # close the previous div, show the headings in user language, |
182 | | - # then open a new div with the page content language again |
183 | | - $r = '</div>' . $r . Html::openElement( 'div', $langAttribs ); |
184 | | - } |
| 178 | + $pageLang = $this->title->getPageLanguage(); |
| 179 | + $langAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() ); |
| 180 | + # close the previous div, show the headings in user language, |
| 181 | + # then open a new div with the page content language again |
| 182 | + $r = '</div>' . $r . Html::openElement( 'div', $langAttribs ); |
185 | 183 | |
186 | 184 | wfProfileOut( __METHOD__ ); |
187 | 185 | return $wgContLang->convert( $r ); |
— | — | @@ -492,8 +490,6 @@ |
493 | 491 | * @private |
494 | 492 | */ |
495 | 493 | function formatList( $articles, $articles_start_char, $cutoff = 6 ) { |
496 | | - global $wgBetterDirectionality; |
497 | | - |
498 | 494 | $list = ''; |
499 | 495 | if ( count ( $articles ) > $cutoff ) { |
500 | 496 | $list = self::columnList( $articles, $articles_start_char ); |
— | — | @@ -502,12 +498,10 @@ |
503 | 499 | $list = self::shortList( $articles, $articles_start_char ); |
504 | 500 | } |
505 | 501 | |
506 | | - if( $wgBetterDirectionality ) { |
507 | | - $pageLang = $this->title->getPageLanguage(); |
508 | | - $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(), |
509 | | - 'class' => 'mw-content-'.$pageLang->getDir() ); |
510 | | - $list = Html::rawElement( 'div', $attribs, $list ); |
511 | | - } |
| 502 | + $pageLang = $this->title->getPageLanguage(); |
| 503 | + $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(), |
| 504 | + 'class' => 'mw-content-'.$pageLang->getDir() ); |
| 505 | + $list = Html::rawElement( 'div', $attribs, $list ); |
512 | 506 | |
513 | 507 | return $list; |
514 | 508 | } |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2257,15 +2257,14 @@ |
2258 | 2258 | * @return String: The doctype, opening <html>, and head element. |
2259 | 2259 | */ |
2260 | 2260 | public function headElement( Skin $sk, $includeStyle = true ) { |
2261 | | - global $wgUseTrackbacks; |
| 2261 | + global $wgUseTrackbacks, $wgLang; |
2262 | 2262 | |
2263 | 2263 | if ( $sk->commonPrintStylesheet() ) { |
2264 | 2264 | $this->addModuleStyles( 'mediawiki.legacy.wikiprintable' ); |
2265 | 2265 | } |
2266 | 2266 | $sk->setupUserCss( $this ); |
2267 | 2267 | |
2268 | | - $lang = wfUILang(); |
2269 | | - $ret = Html::htmlHeader( array( 'lang' => $lang->getCode(), 'dir' => $lang->getDir() ) ); |
| 2268 | + $ret = Html::htmlHeader( array( 'lang' => $wgLang->getCode(), 'dir' => $wgLang->getDir() ) ); |
2270 | 2269 | |
2271 | 2270 | if ( $this->getHTMLTitle() == '' ) { |
2272 | 2271 | $this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ) ); |
— | — | @@ -2311,9 +2310,11 @@ |
2312 | 2311 | Xml::escapeJsString( $editUrl ) . "'"; |
2313 | 2312 | } |
2314 | 2313 | |
2315 | | - # Class bloat |
2316 | | - $dir = wfUILang()->getDir(); |
2317 | | - $bodyAttrs['class'] = "mediawiki $dir"; |
| 2314 | + # Classes for LTR/RTL directionality support |
| 2315 | + global $wgLang, $wgContLang; |
| 2316 | + $userdir = $wgLang->getDir(); |
| 2317 | + $sitedir = $wgContLang->getDir(); |
| 2318 | + $bodyAttrs['class'] = "mediawiki $userdir sitedir-$sitedir"; |
2318 | 2319 | |
2319 | 2320 | if ( $this->getContext()->getLang()->capitalizeAllNouns() ) { |
2320 | 2321 | # A <body> class is probably not the best way to do this . . . |
— | — | @@ -3020,8 +3021,8 @@ |
3021 | 3022 | */ |
3022 | 3023 | protected function styleLink( $style, $options ) { |
3023 | 3024 | if( isset( $options['dir'] ) ) { |
3024 | | - $siteDir = wfUILang()->getDir(); |
3025 | | - if( $siteDir != $options['dir'] ) { |
| 3025 | + global $wgLang; |
| 3026 | + if( $wgLang->getDir() != $options['dir'] ) { |
3026 | 3027 | return ''; |
3027 | 3028 | } |
3028 | 3029 | } |
Index: trunk/phase3/includes/resourceloader/ResourceLoaderContext.php |
— | — | @@ -140,11 +140,8 @@ |
141 | 141 | if ( $this->direction === null ) { |
142 | 142 | $this->direction = $this->request->getVal( 'dir' ); |
143 | 143 | if ( !$this->direction ) { |
144 | | - global $wgBetterDirectionality, $wgContLang; |
145 | | - // if $wgBetterDirectionality is true, set |
146 | | - // directionality based on user language (see bug 6100) |
147 | | - $this->direction = ( $wgBetterDirectionality ? |
148 | | - Language::factory( $this->language )->getDir() : $wgContLang->getDir() ); |
| 144 | + # directionality based on user language (see bug 6100) |
| 145 | + $this->direction = Language::factory( $this->language )->getDir(); |
149 | 146 | } |
150 | 147 | } |
151 | 148 | return $this->direction; |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -124,8 +124,8 @@ |
125 | 125 | |
126 | 126 | # No need to display noarticletext, we use our own message, output in openShowImage() |
127 | 127 | if ( $this->mPage->getID() ) { |
128 | | - # When $wgBetterDirectionality is enabled, NS_FILE is in the user language, |
129 | | - # but this section (the actual wikitext) should be in page content language |
| 128 | + # NS_FILE is in the user language, but this section (the actual wikitext) |
| 129 | + # should be in page content language |
130 | 130 | $pageLang = $this->getTitle()->getPageLanguage(); |
131 | 131 | $wgOut->addHTML( Xml::openElement( 'div', array( 'id' => 'mw-imagepage-content', |
132 | 132 | 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(), |
— | — | @@ -273,7 +273,7 @@ |
274 | 274 | $maxWidth = $max[0]; |
275 | 275 | $maxHeight = $max[1]; |
276 | 276 | $sk = $wgUser->getSkin(); |
277 | | - $dirmark = wfUILang()->getDirMark(); |
| 277 | + $dirmark = $wgLang->getDirMark(); |
278 | 278 | |
279 | 279 | if ( $this->displayImg->exists() ) { |
280 | 280 | # image |
Index: trunk/phase3/includes/Pager.php |
— | — | @@ -947,7 +947,7 @@ |
948 | 948 | * A navigation bar with images |
949 | 949 | */ |
950 | 950 | function getNavigationBar() { |
951 | | - global $wgStylePath; |
| 951 | + global $wgStylePath, $wgLang; |
952 | 952 | |
953 | 953 | if ( !$this->isNavigationBarShown() ) { |
954 | 954 | return ''; |
— | — | @@ -972,7 +972,7 @@ |
973 | 973 | 'next' => 'arrow_disabled_right_25.png', |
974 | 974 | 'last' => 'arrow_disabled_last_25.png', |
975 | 975 | ); |
976 | | - if( wfUILang()->isRTL() ) { |
| 976 | + if( $wgLang->isRTL() ) { |
977 | 977 | $keys = array_keys( $labels ); |
978 | 978 | $images = array_combine( $keys, array_reverse( $images ) ); |
979 | 979 | $disabledImages = array_combine( $keys, array_reverse( $disabledImages ) ); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2408,9 +2408,12 @@ |
2409 | 2409 | $wgEdititis = false; |
2410 | 2410 | |
2411 | 2411 | /** |
2412 | | - * Experimental better directionality support. |
| 2412 | + * Better directionality support (bug 6100 and related). |
| 2413 | + * Removed in 1.19, still kept here for LiquidThreads backwards compatibility. |
| 2414 | + * |
| 2415 | + * @deprecated since 1.19 |
2413 | 2416 | */ |
2414 | | -$wgBetterDirectionality = false; |
| 2417 | +$wgBetterDirectionality = true; |
2415 | 2418 | |
2416 | 2419 | |
2417 | 2420 | /** @} */ # End of output format settings } |
Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -934,14 +934,10 @@ |
935 | 935 | * @return string |
936 | 936 | */ |
937 | 937 | function addHeader( $diff, $otitle, $ntitle, $multi = '', $notice = '' ) { |
938 | | - global $wgBetterDirectionality; |
939 | | - $tableClass = 'diff'; |
940 | | - if( $wgBetterDirectionality ) { |
941 | | - // shared.css sets diff in interface language/dir, |
942 | | - // but the actual content should be in the page language/dir |
943 | | - $pageLang = $this->mTitle->getPageLanguage(); |
944 | | - $tableClass .= ' diff-contentalign-' . htmlspecialchars( $pageLang->alignStart() ); |
945 | | - } |
| 938 | + // shared.css sets diff in interface language/dir, |
| 939 | + // but the actual content should be in the page language/dir |
| 940 | + $pageLang = $this->mTitle->getPageLanguage(); |
| 941 | + $tableClass = 'diff diff-contentalign-' . htmlspecialchars( $pageLang->alignStart() ); |
946 | 942 | $header = "<table class='$tableClass'>"; |
947 | 943 | if ( $diff ) { // Safari/Chrome show broken output if cols not used |
948 | 944 | $header .= " |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -299,36 +299,31 @@ |
300 | 300 | $tpl->setRef( 'serverurl', $wgServer ); |
301 | 301 | $tpl->setRef( 'logopath', $wgLogo ); |
302 | 302 | |
303 | | - $lang = wfUILang(); |
304 | | - $tpl->set( 'lang', $lang->getCode() ); |
305 | | - $tpl->set( 'dir', $lang->getDir() ); |
306 | | - $tpl->set( 'rtl', $lang->isRTL() ); |
| 303 | + $contentlang = $wgContLang->getCode(); |
| 304 | + $contentdir = $wgContLang->getDir(); |
| 305 | + $userlang = $wgLang->getCode(); |
| 306 | + $userdir = $wgLang->getDir(); |
307 | 307 | |
| 308 | + $tpl->set( 'lang', $userlang ); |
| 309 | + $tpl->set( 'dir', $userdir ); |
| 310 | + $tpl->set( 'rtl', $wgLang->isRTL() ); |
| 311 | + |
308 | 312 | $tpl->set( 'capitalizeallnouns', $wgLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '' ); |
309 | 313 | $tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) ); |
310 | 314 | $tpl->set( 'username', $wgUser->isAnon() ? null : $this->username ); |
311 | 315 | $tpl->setRef( 'userpage', $this->userpage ); |
312 | 316 | $tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href'] ); |
313 | | - $tpl->set( 'userlang', $wgLang->getCode() ); |
| 317 | + $tpl->set( 'userlang', $userlang ); |
314 | 318 | |
315 | 319 | // Users can have their language set differently than the |
316 | 320 | // content of the wiki. For these users, tell the web browser |
317 | 321 | // that interface elements are in a different language. |
318 | 322 | $tpl->set( 'userlangattributes', '' ); |
319 | | - $tpl->set( 'specialpageattributes', '' ); |
| 323 | + $tpl->set( 'specialpageattributes', '' ); # obsolete |
320 | 324 | |
321 | | - $lang = $wgLang->getCode(); |
322 | | - $dir = $wgLang->getDir(); |
323 | | - if ( $lang !== $wgContLang->getCode() || $dir !== $wgContLang->getDir() ) { |
324 | | - $attrs = " lang='$lang' dir='$dir'"; |
325 | | - |
| 325 | + if ( $userlang !== $contentlang || $userdir !== $contentdir ) { |
| 326 | + $attrs = " lang='$userlang' dir='$userdir'"; |
326 | 327 | $tpl->set( 'userlangattributes', $attrs ); |
327 | | - |
328 | | - // The content of SpecialPages should be presented in the |
329 | | - // user's language. Content of regular pages should not be touched. |
330 | | - if( $this->getTitle()->isSpecialPage() ) { |
331 | | - $tpl->set( 'specialpageattributes', $attrs ); |
332 | | - } |
333 | 328 | } |
334 | 329 | |
335 | 330 | $newtalks = $this->getNewtalks( $out ); |
— | — | @@ -454,19 +449,18 @@ |
455 | 450 | $tpl->set( 'bottomscripts', $this->bottomScripts( $out ) ); |
456 | 451 | $tpl->set( 'printfooter', $this->printSource() ); |
457 | 452 | |
458 | | - global $wgBetterDirectionality; |
459 | | - if ( $wgBetterDirectionality ) { |
460 | | - // not for special pages or file pages AND only when viewing AND if the page exists |
461 | | - // (or is in MW namespace, because that has default content) |
462 | | - if( !in_array( $this->getTitle()->getNamespace(), array( NS_SPECIAL, NS_FILE ) ) && |
463 | | - in_array( $action, array( 'view', 'render', 'print' ) ) && |
464 | | - ( $this->getTitle()->exists() || $this->getTitle()->getNamespace() == NS_MEDIAWIKI ) ) { |
465 | | - $pageLang = $this->getTitle()->getPageLanguage(); |
466 | | - $realBodyAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(), |
467 | | - 'class' => 'mw-content-'.$pageLang->getDir() ); |
468 | | - $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext ); |
469 | | - } |
| 453 | + # Add a <div class="mw-content-ltr/rtl"> around the body text |
| 454 | + # not for special pages or file pages AND only when viewing AND if the page exists |
| 455 | + # (or is in MW namespace, because that has default content) |
| 456 | + if( !in_array( $this->getTitle()->getNamespace(), array( NS_SPECIAL, NS_FILE ) ) && |
| 457 | + in_array( $action, array( 'view', 'render', 'print' ) ) && |
| 458 | + ( $this->getTitle()->exists() || $this->getTitle()->getNamespace() == NS_MEDIAWIKI ) ) { |
| 459 | + $pageLang = $this->getTitle()->getPageLanguage(); |
| 460 | + $realBodyAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(), |
| 461 | + 'class' => 'mw-content-'.$pageLang->getDir() ); |
| 462 | + $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext ); |
470 | 463 | } |
| 464 | + |
471 | 465 | $tpl->setRef( 'bodytext', $out->mBodytext ); |
472 | 466 | |
473 | 467 | # Language links |
Index: trunk/phase3/includes/specials/SpecialDoubleRedirects.php |
— | — | @@ -76,6 +76,8 @@ |
77 | 77 | } |
78 | 78 | |
79 | 79 | function formatResult( $skin, $result ) { |
| 80 | + global $wgLang; |
| 81 | + |
80 | 82 | $titleA = Title::makeTitle( $result->namespace, $result->title ); |
81 | 83 | |
82 | 84 | if ( $result && !isset( $result->nsb ) ) { |
— | — | @@ -117,7 +119,7 @@ |
118 | 120 | array( 'redirect' => 'no' ) |
119 | 121 | ); |
120 | 122 | $linkC = $skin->linkKnown( $titleC ); |
121 | | - $arr = wfUILang()->getArrow() . wfUILang()->getDirMark(); |
| 123 | + $arr = $wgLang->getArrow() . $wgLang->getDirMark(); |
122 | 124 | |
123 | 125 | return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" ); |
124 | 126 | } |
Index: trunk/phase3/includes/specials/SpecialListredirects.php |
— | — | @@ -108,8 +108,9 @@ |
109 | 109 | # Find out where the redirect leads |
110 | 110 | $target = $this->getRedirectTarget( $result ); |
111 | 111 | if( $target ) { |
| 112 | + global $wgLang; |
112 | 113 | # Make a link to the destination page |
113 | | - $arr = wfUILang()->getArrow() . wfUILang()->getDirMark(); |
| 114 | + $arr = $wgLang->getArrow() . $wgLang->getDirMark(); |
114 | 115 | $targetLink = $skin->link( $target ); |
115 | 116 | return "$rd_link $arr $targetLink"; |
116 | 117 | } else { |
Index: trunk/phase3/includes/specials/SpecialAllmessages.php |
— | — | @@ -411,8 +411,7 @@ |
412 | 412 | } |
413 | 413 | |
414 | 414 | function getCellAttrs( $field, $value ){ |
415 | | - global $wgBetterDirectionality; |
416 | | - if( $field != 'am_title' && $wgBetterDirectionality ) { |
| 415 | + if( $field != 'am_title' ) { |
417 | 416 | return array( 'lang' => $this->langcode, 'dir' => $this->lang->getDir() ); |
418 | 417 | } elseif( $this->mCurrentRow->am_customised && $field == 'am_title' ) { |
419 | 418 | return array( 'rowspan' => '2', 'class' => $field ); |
Index: trunk/phase3/includes/specials/SpecialShortpages.php |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | |
89 | 89 | function formatResult( $skin, $result ) { |
90 | 90 | global $wgLang; |
91 | | - $dm = wfUILang()->getDirMark(); |
| 91 | + $dm = $wgLang->getDirMark(); |
92 | 92 | |
93 | 93 | $title = Title::makeTitle( $result->namespace, $result->title ); |
94 | 94 | if ( !$title ) { |
Index: trunk/phase3/includes/specials/SpecialDisambiguations.php |
— | — | @@ -122,13 +122,15 @@ |
123 | 123 | } |
124 | 124 | |
125 | 125 | function formatResult( $skin, $result ) { |
| 126 | + global $wgLang; |
| 127 | + |
126 | 128 | $title = Title::newFromID( $result->value ); |
127 | 129 | $dp = Title::makeTitle( $result->namespace, $result->title ); |
128 | 130 | |
129 | 131 | $from = $skin->link( $title ); |
130 | 132 | $edit = $skin->link( $title, wfMsgExt( 'parentheses', array( 'escape' ), wfMsg( 'editlink' ) ) , |
131 | 133 | array(), array( 'redirect' => 'no', 'action' => 'edit' ) ); |
132 | | - $arr = wfUILang()->getArrow(); |
| 134 | + $arr = $wgLang->getArrow(); |
133 | 135 | $to = $skin->link( $dp ); |
134 | 136 | |
135 | 137 | return "$from $edit $arr $to"; |
Index: trunk/phase3/includes/specials/SpecialBrokenRedirects.php |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | array(), |
118 | 118 | array( 'broken' ) |
119 | 119 | ); |
120 | | - $arr = wfUILang()->getArrow(); |
| 120 | + $arr = $wgLang->getArrow(); |
121 | 121 | |
122 | 122 | $out = $from . wfMsg( 'word-separator' ); |
123 | 123 | |
Index: trunk/phase3/includes/specials/SpecialFileDuplicateSearch.php |
— | — | @@ -126,14 +126,12 @@ |
127 | 127 | } |
128 | 128 | |
129 | 129 | if( $this->hash != '' ) { |
130 | | - $align = wfUILang()->alignEnd(); |
131 | | - |
132 | 130 | # Show a thumbnail of the file |
133 | 131 | $img = $this->file; |
134 | 132 | if ( $img ) { |
135 | 133 | $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) ); |
136 | 134 | if( $thumb ) { |
137 | | - $wgOut->addHTML( '<div style="float:' . $align . '" id="mw-fileduplicatesearch-icon">' . |
| 135 | + $wgOut->addHTML( '<div class="mw-float-end" id="mw-fileduplicatesearch-icon">' . |
138 | 136 | $thumb->toHtml( array( 'desc-link' => false ) ) . '<br />' . |
139 | 137 | wfMsgExt( 'fileduplicatesearch-info', array( 'parse' ), |
140 | 138 | $wgLang->formatNum( $img->getWidth() ), |
Index: trunk/phase3/includes/specials/SpecialWhatlinkshere.php |
— | — | @@ -268,6 +268,9 @@ |
269 | 269 | } |
270 | 270 | |
271 | 271 | protected function listItem( $row, $nt, $notClose = false ) { |
| 272 | + global $wgLang; |
| 273 | + $dirmark = $wgLang->getDirMark(); |
| 274 | + |
272 | 275 | # local message cache |
273 | 276 | static $msgcache = null; |
274 | 277 | if ( $msgcache === null ) { |
— | — | @@ -310,7 +313,6 @@ |
311 | 314 | $wlhLink = $this->wlhLink( $nt, $msgcache['whatlinkshere-links'] ); |
312 | 315 | $wlh = Xml::wrapClass( "($wlhLink)", 'mw-whatlinkshere-tools' ); |
313 | 316 | |
314 | | - $dirmark = wfUILang()->getDirMark(); |
315 | 317 | return $notClose ? |
316 | 318 | Xml::openElement( 'li' ) . "$link $propsText $dirmark $wlh\n" : |
317 | 319 | Xml::tags( 'li', null, "$link $propsText $dirmark $wlh" ) . "\n"; |
Index: trunk/phase3/includes/specials/SpecialProtectedpages.php |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | } |
118 | 118 | |
119 | 119 | if(!is_null($size = $row->page_len)) { |
120 | | - $stxt = wfUILang()->getDirMark() . ' ' . $skin->formatRevisionSize( $size ); |
| 120 | + $stxt = $wgLang->getDirMark() . ' ' . $skin->formatRevisionSize( $size ); |
121 | 121 | } |
122 | 122 | |
123 | 123 | # Show a link to the change protection form for allowed users otherwise a link to the protection log |
— | — | @@ -145,7 +145,7 @@ |
146 | 146 | return Html::rawElement( |
147 | 147 | 'li', |
148 | 148 | array(), |
149 | | - wfSpecialList( $link . $stxt, $wgLang->commaList( $description_items ) ) . $changeProtection ) . "\n"; |
| 149 | + wfSpecialList( $link . $stxt, $wgLang->commaList( $description_items ), false ) . $changeProtection ) . "\n"; |
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -627,7 +627,7 @@ |
628 | 628 | array( 'action' => 'history' ) |
629 | 629 | ); |
630 | 630 | |
631 | | - $comment = wfUILang()->getDirMark() . $sk->revComment( $rev, false, true ); |
| 631 | + $comment = $wgLang->getDirMark() . $sk->revComment( $rev, false, true ); |
632 | 632 | $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true ); |
633 | 633 | if( $rev->userCan( Revision::DELETED_TEXT ) ) { |
634 | 634 | $d = $sk->linkKnown( |
— | — | @@ -684,7 +684,7 @@ |
685 | 685 | $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')'; |
686 | 686 | |
687 | 687 | |
688 | | - $diffOut = ' . . ' . wfUILang()->getDirMark() . ( $this->showSizeDiff ? |
| 688 | + $diffOut = ' . . ' . $wgLang->getDirMark() . ( $this->showSizeDiff ? |
689 | 689 | ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len ) : Linker::formatRevisionSize( $row->rev_len ) ); |
690 | 690 | |
691 | 691 | $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$diffOut}{$userlink} {$comment} {$topmarktext}"; |
Index: trunk/phase3/includes/specials/SpecialNewpages.php |
— | — | @@ -302,7 +302,7 @@ |
303 | 303 | |
304 | 304 | $classes = array(); |
305 | 305 | |
306 | | - $dm = wfUILang()->getDirMark(); |
| 306 | + $dm = $wgLang->getDirMark(); |
307 | 307 | |
308 | 308 | $title = Title::makeTitleSafe( $result->rc_namespace, $result->rc_title ); |
309 | 309 | $time = Html::element( 'span', array( 'class' => 'mw-newpages-time' ), |
Index: trunk/phase3/includes/LogPage.php |
— | — | @@ -259,7 +259,7 @@ |
260 | 260 | } elseif ( $type == 'protect' && count($params) == 3 ) { |
261 | 261 | // Restrictions and expiries |
262 | 262 | if( $skin ) { |
263 | | - $details .= htmlspecialchars( " {$params[1]}" ); |
| 263 | + $details .= $wgLang->getDirMark() . htmlspecialchars( " {$params[1]}" ); |
264 | 264 | } else { |
265 | 265 | $details .= " {$params[1]}"; |
266 | 266 | } |