Index: trunk/extensions/Translate/MessageGroups.php |
— | — | @@ -644,6 +644,35 @@ |
645 | 645 | return $rev->getText(); |
646 | 646 | } |
647 | 647 | |
| 648 | + public function fillCollection( MessageCollection $messages ) { |
| 649 | + parent::fillCollection( $messages ); |
| 650 | + $page = TranslatablePage::newFromTitle( $this->title ); |
| 651 | + $markedRevs = $page->getMarkedRevs( 'tp:mark' ); |
| 652 | + |
| 653 | + foreach ( $messages as $key => $m ) { |
| 654 | + $rev = $page->getTransrev( $key .'/' . $messages->code ); |
| 655 | + if ( $rev === false ) { |
| 656 | + $m->database = TRANSLATE_FUZZY . $m->database; |
| 657 | + continue; |
| 658 | + } |
| 659 | + foreach ( $markedRevs as $r ) { |
| 660 | + var_dump( $rev ); |
| 661 | + if ( $rev === $r->rt_revision ) break; |
| 662 | + $changed = explode( '|', unserialize($r->rt_value) ); |
| 663 | + |
| 664 | + // Get a suitable section key |
| 665 | + $parts = explode( '/', $key ); |
| 666 | + $ikey = $parts[count($parts)-1]; |
| 667 | + |
| 668 | + // If the section was changed, reduce the score |
| 669 | + if ( in_array($ikey, $changed, true) ) { |
| 670 | + $m->database = TRANSLATE_FUZZY . $m->database; |
| 671 | + continue 2; |
| 672 | + } |
| 673 | + } |
| 674 | + } |
| 675 | + } |
| 676 | + |
648 | 677 | } |
649 | 678 | |
650 | 679 | |
Index: trunk/extensions/Translate/tag/TranslatablePage.php |
— | — | @@ -246,7 +246,7 @@ |
247 | 247 | return $translate->getFullURL( $params ); |
248 | 248 | } |
249 | 249 | |
250 | | - protected function getMarkedRevs( $tag ) { |
| 250 | + public function getMarkedRevs( $tag ) { |
251 | 251 | $db = wfGetDB( DB_SLAVE ); |
252 | 252 | |
253 | 253 | // Can this be done in one query? |
— | — | @@ -315,8 +315,9 @@ |
316 | 316 | $total = 0; |
317 | 317 | |
318 | 318 | foreach ( $collection as $key => $message ) { |
319 | | - if ( !$message->translated() ) continue; // No score |
320 | 319 | |
| 320 | + if ( $message->translation() === null ) continue; // No score |
| 321 | + |
321 | 322 | $score = 1; |
322 | 323 | |
323 | 324 | // Fuzzy halves score |