r108333 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108332‎ | r108333 | r108334 >
Date:22:57, 7 January 2012
Author:amire80
Status:resolved
Tags:
Comment:
Automatic creation of workflow states.
Modified paths:
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/_autoload.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageGroups.php
@@ -984,7 +984,48 @@
985985 return $group->getMessage( $handle->getKey(), $code );
986986 }
987987 }
 988+}
988989
 990+class WorkflowStatesMessageGroup extends WikiMessageGroup {
 991+ // id and source are not needed
 992+ public function __construct() {}
 993+
 994+ public function getId() {
 995+ return 'translate-workflow-states';
 996+ }
 997+
 998+ public function getLabel() {
 999+ return wfMessage( 'translate-workflowgroup-label' )->text();
 1000+ }
 1001+
 1002+ public function getDescription() {
 1003+ return wfMessage( 'translate-workflowgroup-desc' )->text();
 1004+ }
 1005+
 1006+ public function getDefinitions() {
 1007+ global $wgTranslateWorkflowStates;
 1008+
 1009+ $defs = array();
 1010+
 1011+ foreach ( array_keys( $wgTranslateWorkflowStates ) as $state ) {
 1012+ $titleString = "Translate-workflow-state-$state";
 1013+
 1014+ // Automatically create pages for workflow states in the original language
 1015+ $title = Title::makeTitle( $this->getNamespace(), $titleString );
 1016+ if ( !$title->exists() ) {
 1017+ $page = new WikiPage( $title );
 1018+ $page->doEdit(
 1019+ $state,
 1020+ wfMessage( 'translate-workflow-autocreated-summary', $state )->inContentLanguage()->text(),
 1021+ EDIT_NEW
 1022+ );
 1023+ }
 1024+
 1025+ $defs[$titleString] = $state;
 1026+ }
 1027+
 1028+ return $defs;
 1029+ }
9891030 }
9901031
9911032 /**
@@ -1056,6 +1097,7 @@
10571098 global $wgEnablePageTranslation, $wgTranslateGroupFiles;
10581099 global $wgTranslateAC, $wgTranslateEC, $wgTranslateCC;
10591100 global $wgAutoloadClasses;
 1101+ global $wgTranslateWorkflowStates;
10601102
10611103 $deps = array();
10621104 $deps[] = new GlobalDependency( 'wgTranslateAddMWExtensionGroups' );
@@ -1091,6 +1133,10 @@
10921134 }
10931135 }
10941136
 1137+ if ( $wgTranslateWorkflowStates ) {
 1138+ $wgTranslateCC['translate-workflow-states'] = new WorkflowStatesMessageGroup();
 1139+ }
 1140+
10951141 $autoload = array();
10961142 wfRunHooks( 'TranslatePostInitGroups', array( &$wgTranslateCC, &$deps, &$autoload ) );
10971143
Index: trunk/extensions/Translate/_autoload.php
@@ -35,6 +35,7 @@
3636 $wgAutoloadClasses['WikiPageMessageGroup'] = $dir . 'MessageGroups.php';
3737 $wgAutoloadClasses['AliasMessageGroup'] = $dir . 'MessageGroups.php';
3838 $wgAutoloadClasses['RecentMessageGroup'] = $dir . 'MessageGroups.php';
 39+$wgAutoloadClasses['WorkflowStatesMessageGroup'] = $dir . 'MessageGroups.php';
3940
4041 $wgAutoloadClasses['MessageCollection'] = $dir . 'MessageCollection.php';
4142 $wgAutoloadClasses['MessageDefinitions'] = $dir . 'MessageCollection.php';
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -407,8 +407,13 @@
408408 'translate-workflow-set-do' => 'Set',
409409 'translate-workflow-set-doing' => 'Setting...',
410410 'translate-workflow-set-done' => 'Set!',
 411+ 'translate-workflow-autocreated-summary' => 'Automatic creation of page for workflow state $1',
411412 'translate-stats-workflow' => 'Status',
412413
 414+ 'translate-workflowgroup-label' => 'Workflow states',
 415+ 'translate-workflowgroup-desc' => 'This message group shows the translation workflow states.
 416+The states are defined in the configuration variable $wgTranslateWorkflowStates.',
 417+
413418 // Dynamic message groups
414419 'translate-dynagroup-recent-label' => 'Recent translations',
415420 'translate-dynagroup-recent-desc' => 'This message group shows all recent translations into this language.
@@ -674,6 +679,7 @@
675680 'translate-workflow-set-do' => 'Submit button text when active',
676681 'translate-workflow-set-doing' => 'Submit button text when waiting for reply from server',
677682 'translate-workflow-set-done' => 'Submit button text when submission completed succesfully',
 683+ 'translate-workflow-autocreated-summary' => 'This is an edit summary for the automatic creation of a workflow state page.',
678684 'translate-stats-workflow' => 'Column header on Special:LanguageStats and Special:MessageGroupStats',
679685 );
680686
@@ -9561,7 +9567,11 @@
95629568 'translate-workflow-set-do' => 'הגדרה',
95639569 'translate-workflow-set-doing' => 'מתבצעת הגדרה...',
95649570 'translate-workflow-set-done' => 'הוגדר!',
 9571+ 'translate-workflow-autocreated-summary' => 'יצירה אוטומטית של דף עם מצב התרגום $1',
95659572 'translate-stats-workflow' => 'מצב',
 9573+ 'translate-workflowgroup-label' => 'מצבי תרגום',
 9574+ 'translate-workflowgroup-desc' => 'קבוצת ההודעות הזאת מציגה את המצבים האפשריים של תרגום הודעות.
 9575+המצבים מוגדרים במשתנה ‎$wgTranslateWorkflowStates בקובץ ההגדרות של ההרחבה Translate.',
95669576 'translate-dynagroup-recent-label' => 'תרגומים אחרונים',
95679577 'translate-dynagroup-recent-desc' => 'קבוצת ההודעות הזאת מציגה את כל התרגומים האחרונים לשפה הזאת.
95689578 זה שימושי בעיקר במצבים "{{int:translate-task-acceptqueue}}" ו"{{int:translate-task-reviewall}}".',

Follow-up revisions

RevisionCommit summaryAuthorDate
r108386* Avoid double parsing of the description...nikerabbit08:38, 9 January 2012

Status & tagging log