Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -122,6 +122,7 @@ |
123 | 123 | |
124 | 124 | // Translation memory updates |
125 | 125 | $wgHooks['Translate:newTranslation'][] = 'TranslationMemoryUpdater::update'; |
| 126 | +$wgHooks['Translate:newTranslation'][] = 'TranslateHooks::updateTM'; |
126 | 127 | |
127 | 128 | // Translation display related |
128 | 129 | $wgHooks['ArticleContentOnDiff'][] = 'TranslateEditAddons::displayOnDiff'; |
Index: trunk/extensions/Translate/TranslateHooks.php |
— | — | @@ -385,5 +385,15 @@ |
386 | 386 | $output = Html::element( 'a', $a, $linktext ); |
387 | 387 | return $parser->insertStripItem( $output, $parser->mStripState ); |
388 | 388 | } |
| 389 | + |
| 390 | + /** |
| 391 | + * Shovels the new translation into TTMServer. |
| 392 | + * Hook: Translate:newTranslation |
| 393 | + */ |
| 394 | + public static function updateTM( MessageHandle $handle, $revision, $text, User $user ) { |
| 395 | + TTMServer::primary()->update( $handle, $text ); |
| 396 | + return true; |
| 397 | + } |
| 398 | + |
389 | 399 | } |
390 | 400 | |
Index: trunk/extensions/Translate/utils/TTMServer.php |
— | — | @@ -116,11 +116,10 @@ |
117 | 117 | |
118 | 118 | // Insert the new translation |
119 | 119 | $row = $deleteConds + array( |
120 | | - 'text' => $targetText, |
| 120 | + 'tmt_text' => $targetText, |
121 | 121 | ); |
122 | 122 | |
123 | | - $uniqueIndex = array( 'tmt_sid', 'tmt_lang' ); |
124 | | - $dbw->insert( 'translate_tmt', array( $uniqueIndex ), $row, __METHOD__ ); |
| 123 | + $dbw->insert( 'translate_tmt', $row, __METHOD__ ); |
125 | 124 | |
126 | 125 | return true; |
127 | 126 | } |