r107065 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107064‎ | r107065 | r107066 >
Date:13:19, 22 December 2011
Author:amire80
Status:ok (Comments)
Tags:
Comment:
Adding basic support for translatable workflow states.
Modified paths:
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialMessageGroupStats.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialTranslate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Translate.i18n.php
@@ -398,6 +398,8 @@
399399 'log-description-translationreview' => 'Log of all reviews to translations and message groups.',
400400 'logentry-translationreview-message' => '$1 {{GENDER:$2|accepted}} translation $3',
401401
 402+ // The actual states, when set, come after the hyphen.
 403+ // The dangling hyphen hints that it's unset.
402404 'translate-workflow-state-' => '(unset)',
403405 'translate-workflowstatus' => 'Status: $1',
404406 'translate-workflow-set-do' => 'Set',
@@ -643,7 +645,7 @@
644646 'group-translate-proofr-member' => '{{doc-group|translate-proofr|member}}',
645647 'grouppage-translate-proofr' => '{{doc-group|translate-proofr|page}}',
646648 'logentry-translationreview-message' => '{{Logentry}}',
647 - 'translate-workflow-state-' => 'Unselectable select option in Special:Translate if workflow state editing is on',
 649+ 'translate-workflow-state-' => 'Unselectable select option in Special:Translate if workflow state editing is on. The dangling hyphen in the message key hints that this state is unset; the actual states have the same key with something after the hyphen.',
648650 'translate-workflowstatus' => 'In Special:Translate if workflow states are in use, $1 is selector or the current state',
649651 'translate-workflow-set-do' => 'Submit button text when active',
650652 'translate-workflow-set-doing' => 'Submit button text when waiting for reply from server',
Index: trunk/extensions/Translate/specials/SpecialTranslate.php
@@ -524,7 +524,9 @@
525525 $selector->setDefault( $current );
526526 $selector->addOption( wfMessage( 'translate-workflow-state-' )->text(), '' );
527527 foreach ( $wgTranslateWorkflowStates as $state ) {
528 - $selector->addOption( $state );
 528+ $stateMessage = wfMessage( "translate-workflow-state-$state" );
 529+ $stateText = $stateMessage->isBlank() ? $state : $stateMessage->text();
 530+ $selector->addOption( $stateText, $state );
529531 }
530532 $state = $selector->getHTML();
531533
Index: trunk/extensions/Translate/specials/SpecialMessageGroupStats.php
@@ -182,7 +182,9 @@
183183 if ( $wgTranslateWorkflowStates ) {
184184 $state = isset( $this->states[$code] ) ? $this->states[$code] : '';
185185 $sort = isset( $this->statemap[$state] ) ? $this->statemap[$state] + 1 : -1;
186 - $out .= "\n\t\t" . $this->table->element( $state, false, $sort );
 186+ $stateMessage = wfMessage( "translate-workflow-state-$state" );
 187+ $stateText = $stateMessage->isBlank() ? $state : $stateMessage->text();
 188+ $out .= "\n\t\t" . $this->table->element( $stateText, false, $sort );
187189 }
188190 $out .= "\n\t" . Html::closeElement( 'tr' ) . "\n";
189191 return $out;
@@ -213,12 +215,16 @@
214216
215217 protected static function getWorkflowStates( $group ) {
216218 $db = wfGetDB( DB_SLAVE );
217 - $res = $db->select( 'translate_groupreviews', array( 'tgr_state', 'tgr_lang' ), array( 'tgr_group' => $group ), __METHOD__ );
 219+ $res = $db->select(
 220+ 'translate_groupreviews',
 221+ array( 'tgr_state', 'tgr_lang' ),
 222+ array( 'tgr_group' => $group ),
 223+ __METHOD__
 224+ );
218225 $states = array();
219226 foreach ( $res as $row ) {
220227 $states[$row->tgr_lang] = $row->tgr_state;
221228 }
222229 return $states;
223230 }
224 -
225231 }

Comments

#Comment by Siebrand (talk | contribs)   14:01, 22 December 2011

I was wondering if we should maybe add basic workflow states (and translation) for them?

Something like: "in[ ]progress", "needs[ ]updating", "proofreading", "ready", "published"?[1]

Status & tagging log