r81168 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81167‎ | r81168 | r81169 >
Date:21:41, 28 January 2011
Author:purodha
Status:reverted (Comments)
Tags:
Comment:
Partial solution of bug 27022 (user proper directionality in message lists) - 1st todo.
Modified paths:
  • /trunk/extensions/Translate/TranslateTasks.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageTable.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslateTasks.php
@@ -177,7 +177,8 @@
178178 }
179179
180180 protected function output() {
181 - $table = new MessageTable( $this->collection, $this->group );
 181+ $code = $this->options->getLanguage();
 182+ $table = new MessageTable( $this->collection, $this->group, $code );
182183 $table->appendEditLinkParams( 'loadtask', $this->getId() );
183184
184185 return $table->fullTable();
@@ -200,7 +201,8 @@
201202 }
202203
203204 protected function output() {
204 - $table = new MessageTable( $this->collection, $this->group );
 205+ $code = $this->options->getLanguage();
 206+ $table = new MessageTable( $this->collection, $this->group, $code );
205207 $table->appendEditLinkParams( 'loadtask', $this->getId() );
206208 $table->setReviewMode();
207209
Index: trunk/extensions/Translate/utils/MessageTable.php
@@ -15,6 +15,7 @@
1616 protected $reviewMode = false;
1717 protected $collection = null;
1818 protected $group = null;
 19+ protected $code = null;
1920 protected $editLinkParams = array();
2021
2122 protected $headers = array(
@@ -23,9 +24,10 @@
2425 'default' => array( 'msg', 'allmessagesdefault' ),
2526 );
2627
27 - public function __construct( MessageCollection $collection, MessageGroup $group ) {
 28+ public function __construct( MessageCollection $collection, MessageGroup $group, $code ) {
2829 $this->collection = $collection;
2930 $this->group = $group;
 31+ $this->code = $code;
3032 $this->setHeaderText( 'table', $group->getLabel() );
3133 $this->appendEditLinkParams( 'loadgroup', $group->getId() );
3234 }
@@ -122,6 +124,10 @@
123125
124126 $optional = wfMsgHtml( 'translate-optional' );
125127
 128+ $mlang = Language::factory( $this->code );
 129+ $mespa = array( 'dir' => $mlang->getDir(), 'lang' => $this->code );
 130+ unset($mlang);
 131+
126132 $batch = new LinkBatch();
127133 if ( method_exists( $batch, 'setCaller' ) ) {
128134 $batch->setCaller( __METHOD__ );
@@ -142,9 +148,10 @@
143149 $title = $this->keyToTitle( $key );
144150
145151 $original = $m->definition();
 152+ #TODO: handle directionality of fallback language(s)
146153 if ( $m->translation() ) {
147154 $message = $m->translation();
148 - $rclasses = array( 'class' => 'translated' );
 155+ $rclasses = array_merge ( $mespa, array( 'class' => 'translated' ) );
149156 } else {
150157 $message = $original;
151158 $rclasses = array( 'class' => 'untranslated' );
@@ -179,7 +186,7 @@
180187 );
181188
182189 $output .= Xml::tags( 'tr', array( 'class' => 'new' ),
183 - Xml::tags( 'td', null, TranslateUtils::convertWhiteSpaceToHTML( $message ) )
 190+ Xml::tags( 'td', $mespa, TranslateUtils::convertWhiteSpaceToHTML( $message ) )
184191 );
185192 } else {
186193 $output .= Xml::tags( 'tr', array( 'class' => 'def' ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r99379Doing r81168 properly, essentially reverting it.nikerabbit22:09, 9 October 2011

Comments

#Comment by Nikerabbit (talk | contribs)   23:48, 28 January 2011
  • You can get the language code from MessageCollection.
  • What is mespa or mlang? Please use descriptive variable names.
#Comment by Siebrand (talk | contribs)   16:37, 8 March 2011

Please follow-up.

#Comment by Purodha (talk | contribs)   10:34, 24 September 2011

Already fixed by a later revision.

#Comment by Nikerabbit (talk | contribs)   21:47, 9 October 2011

Please provide the revision numbers.

Status & tagging log