Index: trunk/extensions/Translate/SpecialManageGroups.php |
— | — | @@ -355,7 +355,8 @@ |
356 | 356 | } elseif ( $action === 'ignore' ) { |
357 | 357 | return array( 'translate-manage-import-ignore', $key ); |
358 | 358 | } elseif ( $action === 'fuzzy' ) { |
359 | | - $title = self::makeTitle( $group, $key, $code ); |
| 359 | + $title = Title::makeTitleSafe( $group->getNamespace(), $key ); |
| 360 | + $comment = wfMsgForContentNoTrans( 'translate-manage-fuzzy-summary' ); |
360 | 361 | return $this->doFuzzy( $title, $message, $comment ); |
361 | 362 | } else { |
362 | 363 | throw new MWException( "Unhandled action $action" ); |
— | — | @@ -368,8 +369,8 @@ |
369 | 370 | |
370 | 371 | protected function doImport( $title, $message, $comment, $user = null ) { |
371 | 372 | $flags = EDIT_FORCE_BOT; |
372 | | - $article = new Article( $title ); |
373 | | - $status = $article->doEdit( $message, $comment, $flags ); |
| 373 | + $article = new Article( $title ); |
| 374 | + $status = $article->doEdit( $message, $comment, $flags, false, $user ); |
374 | 375 | $success = $status->isOK(); |
375 | 376 | |
376 | 377 | if ( $success ) { |
— | — | @@ -382,9 +383,11 @@ |
383 | 384 | } |
384 | 385 | |
385 | 386 | protected function doFuzzy( $title, $message, $comment ) { |
| 387 | + global $wgUser; |
| 388 | + |
386 | 389 | $dbw = wfGetDB( DB_MASTER ); |
387 | 390 | $titleText = $title->getDBKey(); |
388 | | - $condArray = array( |
| 391 | + $conds = array( |
389 | 392 | 'page_namespace' => $title->getNamespace(), |
390 | 393 | 'page_latest=rev_id', |
391 | 394 | 'rev_text_id=old_id', |
— | — | @@ -403,26 +406,26 @@ |
404 | 407 | foreach ( $rows as $row ) { |
405 | 408 | $ttitle = Title::makeTitle( $row->page_namespace, $row->page_title ); |
406 | 409 | |
407 | | - $changed[] = $this->doImport( |
408 | | - $ttitle, |
409 | | - TRANSLATE_FUZZY . Revision::getRevisionText( $row ), |
410 | | - $comment, |
411 | | - $fuzzybot |
412 | | - ); |
| 410 | + // Avoid double-fuzzying |
| 411 | + $text = Revision::getRevisionText( $row ); |
| 412 | + $text = str_replace( TRANSLATE_FUZZY, '', $text ); |
| 413 | + $text = TRANSLATE_FUZZY . $text; |
413 | 414 | |
| 415 | + $changed[] = $this->doImport( $ttitle, $text, "[{$wgUser->getName()}] " . $comment, $fuzzybot ); |
414 | 416 | if ( $this->checkProcessTime() ) break; |
415 | 417 | |
416 | 418 | } |
417 | 419 | |
418 | | - if ( count($changed) === count($rows) ) { |
419 | | - $comment = wfMsgForContentNoTrans( 'translate-manage-import-summary' ); |
420 | | - $changed[] = $this->doImport( $title, $message, $comment ); |
| 420 | + if ( count($changed) === $rows->numRows() ) { |
| 421 | + $comment = "[{$wgUser->getName()}] " . wfMsgForContentNoTrans( 'translate-manage-import-summary' ); |
| 422 | + $title = Title::makeTitleSafe( $title->getNamespace, $title->getPrefixedDbKey() . '/en' ); |
| 423 | + $changed[] = $this->doImport( $title, $message, $comment, $fuzzybot ); |
421 | 424 | } |
422 | 425 | |
423 | 426 | $text = ''; |
424 | 427 | foreach ( $changed as $c ) { |
425 | 428 | $key = array_shift( $c ); |
426 | | - $text = "* " . wfMsgExt( $key, array(), $c ); |
| 429 | + $text .= "* " . wfMsgExt( $key, array(), $c ) . "\n"; |
427 | 430 | } |
428 | 431 | |
429 | 432 | return array( 'translate-manage-import-fuzzy', |
Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -267,6 +267,7 @@ |
268 | 268 | 'translate-manage-import-summary' => 'Importing a new version from external source', |
269 | 269 | 'translate-manage-conflict-summary' => 'Importing a new version from external source. |
270 | 270 | Please check.', |
| 271 | + 'translate-manage-fuzzy-summary' => 'The definition has changed', |
271 | 272 | 'translate-manage-import-fuzzy' => 'Importing and fuzzying: $1', |
272 | 273 | |
273 | 274 | 'translate-manage-import-done' => 'All done!', |