Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -145,7 +145,9 @@ |
146 | 146 | |
147 | 147 | // Logs |
148 | 148 | $wgLogTypes[] = 'translationreview'; |
| 149 | +$wgLogTypes[] = 'groupreview'; |
149 | 150 | $wgLogActionsHandlers['translationreview/message'] = 'TranslateHooks::formatTranslationreviewLogEntry'; |
| 151 | +$wgLogActionsHandlers['translationreview/group'] = 'TranslateHooks::formatTranslationreviewLogEntry'; |
150 | 152 | // BC for <1.19 |
151 | 153 | $wgLogHeaders['pagetranslation'] = 'log-description-translationreview'; |
152 | 154 | $wgLogNames['pagetranslation'] = 'log-name-translationreview'; |
Index: trunk/extensions/Translate/TranslateHooks.php |
— | — | @@ -325,6 +325,26 @@ |
326 | 326 | Message::rawParam( $linker->link( $title, null, array(), array( 'oldid' => $params[0] ) ) ) |
327 | 327 | )->inLanguage( $language )->text(); |
328 | 328 | } |
| 329 | + |
| 330 | + if ( $action === 'group' ) { |
| 331 | + $languageCode = $params[0]; |
| 332 | + $languageNames = Language::getTranslatedLanguageNames( $languageCode ); |
| 333 | + $languageName = "$languageNames[$languageCode] ($languageCode)"; |
| 334 | + $oldStateMessage = wfMessage( "translate-workflow-state-$params[2]" ); |
| 335 | + $newStateMessage = wfMessage( "translate-workflow-state-$params[3]" ); |
| 336 | + $oldState = $oldStateMessage->isBlank() ? $oldState : $oldStateMessage->text(); |
| 337 | + $newState = $newStateMessage->isBlank() ? $newState : $newStateMessage->text(); |
| 338 | + |
| 339 | + return wfMessage( 'logentry-groupreview-message' )->params( |
| 340 | + '', // User link in the new system |
| 341 | + '#', // User name for gender in the new system |
| 342 | + $languageName, |
| 343 | + $params[1], // group |
| 344 | + $oldState, |
| 345 | + $newState |
| 346 | + )->inLanguage( $language )->text() . $bla; |
| 347 | + } |
| 348 | + |
329 | 349 | return ''; |
330 | 350 | } |
331 | 351 | |
— | — | @@ -338,7 +358,6 @@ |
339 | 359 | $group = $handle->getGroup(); |
340 | 360 | $callParams = array( $title->getPrefixedText(), $group->getId() ); |
341 | 361 | $call = Xml::encodeJsCall( 'mw.translate.openDialog', $callParams ); |
342 | | - |
343 | 362 | $js = <<<JAVASCRIPT |
344 | 363 | mw.loader.using( 'ext.translate.quickedit', function() { $call; } ); return false; |
345 | 364 | JAVASCRIPT; |
— | — | @@ -355,5 +374,5 @@ |
356 | 375 | $output = Html::element( 'a', $a, $linktext ); |
357 | 376 | return $parser->insertStripItem( $output, $parser->mStripState ); |
358 | 377 | } |
| 378 | +} |
359 | 379 | |
360 | | -} |
Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -1,4 +1,4 @@ |
2 | | -<?php |
| 2 | + workflow states<?php |
3 | 3 | /** |
4 | 4 | * Translations for the core of the Translate extension. |
5 | 5 | * |
— | — | @@ -398,6 +398,7 @@ |
399 | 399 | 'log-name-translationreview' => 'Translation review log', |
400 | 400 | 'log-description-translationreview' => 'Log of all reviews to translations and message groups.', |
401 | 401 | 'logentry-translationreview-message' => '$1 {{GENDER:$2|accepted}} translation $3', |
| 402 | + 'logentry-groupreview-message' => '$1 {{GENDER:$2|changed}} the status of $3 translations of message group $4 from $5 to $6', |
402 | 403 | |
403 | 404 | // The actual states, when set, come after the hyphen. |
404 | 405 | // The dangling hyphen hints that it's unset. |
— | — | @@ -649,6 +650,13 @@ |
650 | 651 | 'group-translate-proofr-member' => '{{doc-group|translate-proofr|member}}', |
651 | 652 | 'grouppage-translate-proofr' => '{{doc-group|translate-proofr|page}}', |
652 | 653 | 'logentry-translationreview-message' => '{{Logentry}}', |
| 654 | + 'logentry-groupreview-message' => '{{Logentry}} Params: |
| 655 | + |
| 656 | +* $1, $2: Performing user account name |
| 657 | +* $3: Language |
| 658 | +* $4: Message group name |
| 659 | +* $5: Previous workflow state |
| 660 | +* $6: New workflow state', |
653 | 661 | '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.', |
654 | 662 | 'translate-workflowstatus' => 'In Special:Translate if workflow states are in use, $1 is selector or the current state', |
655 | 663 | 'translate-workflow-set-do' => 'Submit button text when active', |
— | — | @@ -9335,6 +9343,7 @@ |
9336 | 9344 | 'log-name-translationreview' => 'יומן סקירת תרגומים', |
9337 | 9345 | 'log-description-translationreview' => 'יומן של כל הסקירות של תרגומים ושל קבוצות תרגומים.', |
9338 | 9346 | 'logentry-translationreview-message' => '$1 {{GENDER:$2|אישר|אישרה}} את התרגום $3', |
| 9347 | + 'logentry-groupreview-message' => '$1 {{GENDER:$2|שינה|שינתה}} את מצב התרגום ל$3 של הקבוצה $4 מ"$5" ל"$6"', |
9339 | 9348 | 'translate-workflow-state-' => '(לא מוגדר)', |
9340 | 9349 | 'translate-workflowstatus' => 'מצב: $1', |
9341 | 9350 | 'translate-workflow-set-do' => 'הגדרה', |
Index: trunk/extensions/Translate/api/ApiGroupReview.php |
— | — | @@ -26,38 +26,57 @@ |
27 | 27 | $this->dieUsage( 'Permission denied', 'permissiondenied' ); |
28 | 28 | } |
29 | 29 | |
30 | | - $params = $this->extractRequestParams(); |
| 30 | + $requestParams = $this->extractRequestParams(); |
31 | 31 | |
32 | | - $group = MessageGroups::getGroup( $params['group'] ); |
| 32 | + $group = MessageGroups::getGroup( $requestParams['group'] ); |
33 | 33 | if ( !$group ) { |
34 | 34 | $this->dieUsageMsg( array( 'missingparam', 'group' ) ); |
35 | 35 | } |
36 | 36 | |
| 37 | + // XXX Is this part needed? |
37 | 38 | $languages = Language::getLanguageNames( false ); |
38 | | - if ( !isset( $languages[$params['language']] ) ) { |
| 39 | + if ( !isset( $languages[$requestParams['language']] ) ) { |
39 | 40 | $this->dieUsageMsg( array( 'missingparam', 'language' ) ); |
40 | 41 | } |
41 | 42 | |
| 43 | + $dbr = wfGetDB( DB_SLAVE ); |
| 44 | + $currentState = $dbr->selectField( |
| 45 | + 'translate_groupreviews', |
| 46 | + 'tgr_state', |
| 47 | + array( 'tgr_group' => $groupid, 'tgr_lang' => $requestParams['language'] ), |
| 48 | + __METHOD__ |
| 49 | + ); |
| 50 | + |
42 | 51 | $dbw = wfGetDB( DB_MASTER ); |
43 | 52 | $table = 'translate_groupreviews'; |
| 53 | + $groupid = $group->getId(); |
44 | 54 | $row = array( |
45 | | - 'tgr_group' => $group->getId(), |
46 | | - 'tgr_lang' => $params['language'], |
47 | | - 'tgr_state' => $params['state'], |
| 55 | + 'tgr_group' => $groupid, |
| 56 | + 'tgr_lang' => $requestParams['language'], |
| 57 | + 'tgr_state' => $requestParams['state'], |
48 | 58 | ); |
49 | 59 | $index = array( 'tgr_group', 'tgr_language' ); |
50 | 60 | $res = $dbw->replace( $table, array( $index ), $row, __METHOD__ ); |
51 | 61 | |
52 | | - /* Will be implemented later |
53 | 62 | $logger = new LogPage( 'translationreview' ); |
54 | | - $params = array( $revision->getId() ); |
55 | | - $logger->addEntry( 'group', $title, null, $params, $wgUser ); |
56 | | - */ |
| 63 | + $logParams = array( |
| 64 | + $requestParams['language'], |
| 65 | + $group->getLabel(), |
| 66 | + $currentState, |
| 67 | + $requestParams['state'], |
| 68 | + ); |
| 69 | + $logger->addEntry( |
| 70 | + 'group', |
| 71 | + SpecialPage::getTitleFor( 'Translate', $groupid ), // It's not really a page |
| 72 | + '', // No comments |
| 73 | + $logParams, |
| 74 | + $wgUser |
| 75 | + ); |
57 | 76 | |
58 | 77 | $output = array( 'review' => array( |
59 | 78 | 'group' => $group->getId(), |
60 | | - 'language' => $params['language'], |
61 | | - 'state' => $params['state'], |
| 79 | + 'language' => $requestParams['language'], |
| 80 | + 'state' => $requestParams['state'], |
62 | 81 | ) ); |
63 | 82 | |
64 | 83 | $this->getResult()->addValue( null, $this->getModuleName(), $output ); |