r91519 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91518‎ | r91519 | r91520 >
Date:02:44, 6 July 2011
Author:robin
Status:ok (Comments)
Tags:
Comment:
(follow-up r91518; bug 29658 et al.) Improving RTL support for several extensions:
AbuseFilter: aligning rules edit box as LTR, since they are essentially English
CodeReview: aligning commit messages according to content language direction; and aligning input boxes on SpecialRepoAdmin as LTR
FlaggedRevs: aligning box shown on articles to content language dir; and adding direction marks to ReviewedPages & UnreviewedPages
LiquidThreads:
* add direction mark
* make headings follow the content language dir
* remove lqt_post_ltr/rtl (added a few commits ago) to use mw-content-ltr/rtl in core
UploadWizard: make calendar input follow user direction (not content direction, as since r91518) (see bug 28902)
Modified paths:
  • /trunk/extensions/AbuseFilter/abusefilter.css (modified) (history)
  • /trunk/extensions/CodeReview/modules/ext.codereview.styles.css (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/SpecialRepoAdmin.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.css (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/specialpages/reports/ReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/specialpages/reports/UnreviewedPages_body.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/Hooks.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.css (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageHistoryView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageView.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/uploadWizard.css (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/uploadWizard.css
@@ -658,6 +658,9 @@
659659 /* @embed */
660660 background: #ffffff url('images/calendar.gif') no-repeat right center;
661661 }
 662+input.mwe-date {
 663+ direction: ltr;
 664+}
662665
663666 .ui-datepicker-current-day a.ui-state-active {
664667 background: #ffff99;
Index: trunk/extensions/AbuseFilter/abusefilter.css
@@ -109,4 +109,15 @@
110110 .mw-abusefilter-diff-multiline td.diff-addedline,
111111 .mw-abusefilter-diff-multiline td.diff-deletedline {
112112 width: 50%;
 113+}
 114+
 115+/* Rules are in English */
 116+/* @noflip */textarea#wpFilterRules { direction: ltr; }
 117+
 118+/* Name is in site content language */
 119+/* @noflip */.sitedir-ltr .TablePager_col_af_public_comments {
 120+ direction: ltr;
 121+}
 122+/* @noflip */.sitedir-rtl .TablePager_col_af_public_comments {
 123+ direction: rtl;
113124 }
\ No newline at end of file
Index: trunk/extensions/CodeReview/modules/ext.codereview.styles.css
@@ -15,6 +15,12 @@
1616 max-width: 20em;
1717 overflow: hidden;
1818 }
 19+/* @noflip */.sitedir-ltr .TablePager_col_cr_message, .sitedir-ltr .mw-codereview-message {
 20+ direction: ltr;
 21+}
 22+/* @noflip */.sitedir-rtl .TablePager_col_cr_message, .sitedir-rtl .mw-codereview-message {
 23+ direction: rtl;
 24+}
1925
2026 .TablePager_col_cr_timestamp {
2127 white-space: nowrap;
Index: trunk/extensions/CodeReview/ui/CodeView.php
@@ -57,7 +57,8 @@
5858
5959 function formatMessage( $text ) {
6060 $text = nl2br( htmlspecialchars( $text ) );
61 - return $this->codeCommentLinkerHtml->link( $text );
 61+ return Html::rawElement( 'div', array( 'class' => 'mw-codereview-message' ),
 62+ $this->codeCommentLinkerHtml->link( $text ) );
6263 }
6364
6465 function messageFragment( $value ) {
Index: trunk/extensions/CodeReview/ui/SpecialRepoAdmin.php
@@ -148,11 +148,11 @@
149149 Xml::buildForm(
150150 array(
151151 'repoadmin-edit-path' =>
152 - Xml::input( 'wpRepoPath', 60, $repoPath ),
 152+ Xml::input( 'wpRepoPath', 60, $repoPath, array( 'dir' => 'ltr') ),
153153 'repoadmin-edit-bug' =>
154 - Xml::input( 'wpBugPath', 60, $bugPath ),
 154+ Xml::input( 'wpBugPath', 60, $bugPath, array( 'dir' => 'ltr') ),
155155 'repoadmin-edit-view' =>
156 - Xml::input( 'wpViewPath', 60, $viewPath ) ) ) .
 156+ Xml::input( 'wpViewPath', 60, $viewPath, array( 'dir' => 'ltr') ) ) ) .
157157 Html::hidden( 'wpEditToken', $wgUser->editToken( $this->repoName ) ) .
158158 Xml::submitButton( wfMsg( 'repoadmin-edit-button' ) ) .
159159 '</form></fieldset>'
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -109,7 +109,7 @@
110110 $paths .= $this->formatPathLine( $row->cp_path, $row->cp_action );
111111 }
112112 if ( $paths ) {
113 - $paths = "<div class='mw-codereview-paths' dir='ltr'><ul>\n$paths</ul></div>\n";
 113+ $paths = "<div class='mw-codereview-paths mw-content-ltr'><ul>\n$paths</ul></div>\n";
114114 }
115115 $comments = $this->formatComments();
116116 $commentsLink = "";
@@ -741,7 +741,7 @@
742742 * @return string
743743 */
744744 protected function formatComment( $comment, $replyForm = '' ) {
745 - global $wgOut, $wgLang;
 745+ global $wgOut, $wgLang, $wgContLang;
746746
747747 if ( $comment->id === 0 ) {
748748 $linkId = 'cpreview';
@@ -770,7 +770,7 @@
771771 ' ' .
772772 $this->commentReplyLink( $comment->id ) .
773773 '</div>' .
774 - '<div class="mw-codereview-comment-text">' .
 774+ '<div class="mw-codereview-comment-text mw-content-' . $wgContLang->getDir() . '">' .
775775 $wgOut->parse( $this->codeCommentLinkerWiki->link( $comment->text ) ) .
776776 '</div>' .
777777 $replyForm .
@@ -782,9 +782,11 @@
783783 * @return string
784784 */
785785 protected function commentStyle( $comment ) {
 786+ global $wgLang;
 787+ $align = $wgLang->AlignStart();
786788 $depth = $comment->threadDepth();
787789 $margin = ( $depth - 1 ) * 48;
788 - return "margin-left: ${margin}px";
 790+ return "margin-$align: ${margin}px";
789791 }
790792
791793 /**
Index: trunk/extensions/LiquidThreads/lqt.css
@@ -1,10 +1,3 @@
2 -/* @noflip */.lqt_post_ltr {
3 - direction: ltr;
4 -}
5 -/* @noflip */.lqt_post_rtl {
6 - direction: rtl;
7 -}
8 -
92 .lqt_watchlist_messages_notice {
103 background-color: #eee;
114 border: 1px solid #ddd;
@@ -188,12 +181,12 @@
189182
190183 .lqt_toc th {
191184 border-bottom: 1px solid #000000;
 185+ text-align: left;
192186 }
193187
194188 .lqt_toc td,.lqt_toc th {
195189 margin: 0;
196190 padding: 0.2em;
197 - text-align: left;
198191 }
199192
200193 .lqt_toc td {
Index: trunk/extensions/LiquidThreads/classes/Hooks.php
@@ -47,6 +47,8 @@
4848 $link = LqtView::linkInContext( $thread );
4949 $s .= ' ' . wfMsgExt( $msg, array( 'parseinline', 'replaceafter' ), $link );
5050
 51+ $s .= $wgLang->getDirMark();
 52+
5153 // add the truncated post content
5254 $quote = $thread->root()->getContent();
5355 $quote = $wgLang->truncate( $quote, 200 );
Index: trunk/extensions/LiquidThreads/classes/View.php
@@ -1493,6 +1493,7 @@
14941494 /** Shows the headING for a thread (as opposed to the headeER for a post within
14951495 a thread). */
14961496 function showThreadHeading( $thread ) {
 1497+ global $wgContLang;
14971498 if ( $thread->hasDistinctSubject() ) {
14981499 if ( $thread->hasSuperthread() ) {
14991500 $commands_html = "";
@@ -1517,7 +1518,7 @@
15181519 $html = Xml::tags( 'span', array( 'class' => 'mw-headline' ), $html );
15191520 $html .= Html::hidden( 'raw-header', $thread->subject() );
15201521 $html = Xml::tags( 'h' . $this->headerLevel,
1521 - array( 'class' => 'lqt_header', 'id' => $id ),
 1522+ array( 'class' => 'lqt_header', 'id' => $id, 'dir' => $wgContLang->getDir() ),
15221523 $html ) . $commands_html;
15231524 }
15241525
@@ -1538,7 +1539,7 @@
15391540 $alternatingClass = "lqt-thread-$alternatingType";
15401541 $dir = $wgContLang->getDir();
15411542
1542 - return "lqt_post $levelClass $alternatingClass lqt_post_$dir";
 1543+ return "lqt_post $levelClass $alternatingClass mw-content-$dir";
15431544 }
15441545
15451546 static function anchorName( $thread ) {
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php
@@ -117,7 +117,7 @@
118118 }
119119
120120 function getTOC( $threads ) {
121 - global $wgLang;
 121+ global $wgLang, $wgContLang;
122122
123123 $html = '';
124124
@@ -145,7 +145,7 @@
146146 $anchor = '#' . $this->anchorName( $thread );
147147 $subject = Xml::tags( 'a', array( 'href' => $anchor ),
148148 Threads::stripHTML( $thread->formattedSubject() ) );
149 - $row .= Xml::tags( 'td', null, $subject );
 149+ $row .= Xml::tags( 'td', array( 'dir' => $wgContLang->getDir() ), $subject );
150150
151151 $row .= Xml::element( 'td', null, $wgLang->formatNum( $thread->replyCount() ) );
152152
Index: trunk/extensions/LiquidThreads/pages/TalkpageHistoryView.php
@@ -76,7 +76,7 @@
7777 }
7878
7979 function formatValue( $name, $value ) {
80 - global $wgLang;
 80+ global $wgLang, $wgContLang;
8181
8282 static $sk = null;
8383
@@ -110,7 +110,7 @@
111111 array( 'known' )
112112 );
113113
114 - return $link;
 114+ return Html::rawElement( 'div', array( 'dir' => $wgContLang->getDir() ), $link );
115115 case 'th_timestamp':
116116 $formatted = $wgLang->timeanddate( $value );
117117 $title = Title::makeTitleSafe(
Index: trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.css
@@ -121,7 +121,7 @@
122122 }
123123
124124 /* @noflip */
125 -.rtl div.flaggedrevs_short {
 125+.sitedir-rtl div.flaggedrevs_short {
126126 float: left;
127127 margin: 0 1em 0 0;
128128 }
Index: trunk/extensions/FlaggedRevs/presentation/specialpages/reports/ReviewedPages_body.php
@@ -86,6 +86,8 @@
8787 $title = Title::newFromRow( $row );
8888 # Link to page
8989 $link = $this->skin->link( $title );
 90+ # Direction mark
 91+ $dirmark = wfUILang()->getDirMark();
9092 # Size (bytes)
9193 $stxt = '';
9294 if ( !is_null( $size = $row->page_len ) ) {
@@ -116,7 +118,7 @@
117119 $best = " [$best]";
118120 }
119121
120 - return "<li>$link $stxt ($list)$best</li>";
 122+ return "<li>$link $dirmark $stxt ($list)$best</li>";
121123 }
122124 }
123125
Index: trunk/extensions/FlaggedRevs/presentation/specialpages/reports/UnreviewedPages_body.php
@@ -109,6 +109,7 @@
110110
111111 $stxt = $underReview = $watching = '';
112112 $link = $this->skin->link( $title, null, array(), 'redirect=no&reviewing=1' );
 113+ $dirmark = wfUILang()->getDirMark();
113114 $hist = $this->skin->linkKnown( $title, wfMsgHtml( 'hist' ),
114115 array(), 'action=history&reviewing=1' );
115116 if ( !is_null( $size = $row->page_len ) ) {
@@ -154,7 +155,7 @@
155156 wfMsgHtml( 'unreviewedpages-viewing' ) . '</span>';
156157 }
157158
158 - return( "<li{$css}>{$link} {$stxt} ({$hist})" .
 159+ return( "<li{$css}>{$link} $dirmark {$stxt} ({$hist})" .
159160 "{$age}{$watching}{$underReview}</li>" );
160161 }
161162

Follow-up revisions

RevisionCommit summaryAuthorDate
r91541Follow-up r91293, r91519: use wfUILang() for better backwards compatibilityrobin09:17, 6 July 2011
r92063Follow-up r91519: ellipsis was not included in the trimmed commit messages in...robin14:04, 13 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91293Better RTL interface support for CodeReview (bug 29658): paths and code diff ...robin21:05, 1 July 2011
r91518(bug 6100; follow-up to r91315) Being bold and removing $wgBetterDirectionali...robin02:26, 6 July 2011

Comments

#Comment by SPQRobin (talk | contribs)   02:52, 6 July 2011

Also, for CodeReview, fixed the margin for the indented comments. It was left for RTL languages as well, which was wrong.

#Comment by Krinkle (talk | contribs)   10:14, 13 July 2011

This revision causes a line break in all trimmed commit summeries:

http://i.imgur.com/Jq2Wb.png http://i.imgur.com/m8mLi.png

Please use a ‎<span> if possible, or set display:inline somewhere.

#Comment by SPQRobin (talk | contribs)   14:06, 13 July 2011

Fixed in r92063. The CSS was set for .TablePager_col_cr_message anyway so I just moved the .mw-codereview-message to CodeRevisionView

#Comment by Krinkle (talk | contribs)   20:01, 13 July 2011

Cool, setting status back to ok.

Status & tagging log