Index: trunk/extensions/Translate/MessageCollection.php |
— | — | @@ -34,6 +34,9 @@ |
35 | 35 | /// \arrayof{String,TMessage} %Message key => messages. |
36 | 36 | protected $messages = null; |
37 | 37 | |
| 38 | + /// Array |
| 39 | + protected $reverseMap; |
| 40 | + |
38 | 41 | // Database resources |
39 | 42 | |
40 | 43 | /// \type{Database Result Resource} Stored message existence and fuzzy state. |
— | — | @@ -127,6 +130,24 @@ |
128 | 131 | } |
129 | 132 | |
130 | 133 | /** |
| 134 | + * Returns list of titles of messages that are used in this collection after filtering. |
| 135 | + * @return \list{Title} |
| 136 | + * @since 2011-12-28 |
| 137 | + */ |
| 138 | + public function getTitles() { |
| 139 | + return array_values( $this->keys ); |
| 140 | + } |
| 141 | + |
| 142 | + /** |
| 143 | + * Returns list of message keys that are used in this collection after filtering. |
| 144 | + * @return \list{String} |
| 145 | + * @since 2011-12-28 |
| 146 | + */ |
| 147 | + public function getMessageKeys() { |
| 148 | + return array_keys( $this->keys ); |
| 149 | + } |
| 150 | + |
| 151 | + /** |
131 | 152 | * Returns stored message tags. |
132 | 153 | * @param $type \string Tag type, usually optional or ignored. |
133 | 154 | * @return \types{\list{String},\null} List of keys or null if no tags. |
— | — | @@ -227,7 +248,7 @@ |
228 | 249 | */ |
229 | 250 | public function resetForNewLanguage( $code ) { |
230 | 251 | $this->code = $code; |
231 | | - $this->keys = $this->fixKeys( array_keys( $this->definitions->messages ) ); |
| 252 | + $this->keys = $this->fixKeys(); |
232 | 253 | $this->dbInfo = null; |
233 | 254 | $this->dbData = null; |
234 | 255 | $this->dbReviewData = null; |
— | — | @@ -381,15 +402,9 @@ |
382 | 403 | $origKeys = $keys; |
383 | 404 | } |
384 | 405 | |
385 | | - $flipKeys = array_flip( $keys ); |
386 | | - |
387 | 406 | foreach ( $this->dbInfo as $row ) { |
388 | 407 | if ( $row->rt_type !== null ) { |
389 | | - if ( !isset( $flipKeys[$row->page_title] ) ) { |
390 | | - continue; |
391 | | - } |
392 | | - |
393 | | - unset( $keys[$flipKeys[$row->page_title]] ); |
| 408 | + unset( $keys[$this->rowToKey( $row )] ); |
394 | 409 | } |
395 | 410 | } |
396 | 411 | |
— | — | @@ -414,15 +429,8 @@ |
415 | 430 | $origKeys = $keys; |
416 | 431 | } |
417 | 432 | |
418 | | - $flipKeys = array_flip( $keys ); |
419 | | - |
420 | 433 | foreach ( $this->dbInfo as $row ) { |
421 | | - // Remove messages which have a translation from keys |
422 | | - if ( !isset( $flipKeys[$row->page_title] ) ) { |
423 | | - continue; |
424 | | - } |
425 | | - |
426 | | - unset( $keys[$flipKeys[$row->page_title]] ); |
| 434 | + unset( $keys[$this->rowToKey( $row )] ); |
427 | 435 | } |
428 | 436 | |
429 | 437 | // Check also if there is something in the file that is not yet in the database |
— | — | @@ -453,18 +461,16 @@ |
454 | 462 | $origKeys = $keys; |
455 | 463 | } |
456 | 464 | |
457 | | - $flipKeys = array_flip( $keys ); |
458 | | - |
459 | 465 | foreach ( $this->dbData as $row ) { |
460 | | - $realKey = $flipKeys[$row->page_title]; |
461 | | - if ( !isset( $this->infile[$realKey] ) ) { |
| 466 | + $mkey = $this->rowToKey( $row ); |
| 467 | + if ( !isset( $this->infile[$mkey] ) ) { |
462 | 468 | continue; |
463 | 469 | } |
464 | 470 | |
465 | 471 | $text = Revision::getRevisionText( $row ); |
466 | | - if ( $this->infile[$realKey] === $text ) { |
| 472 | + if ( $this->infile[$mkey] === $text ) { |
467 | 473 | // Remove unchanged messages from the list |
468 | | - unset( $keys[$realKey] ); |
| 474 | + unset( $keys[$mkey] ); |
469 | 475 | } |
470 | 476 | } |
471 | 477 | |
— | — | @@ -488,15 +494,13 @@ |
489 | 495 | protected function filterReviewer( array $keys, /*bool*/ $condition, /*int*/ $user ) { |
490 | 496 | $this->loadReviewInfo( $keys ); |
491 | 497 | $origKeys = $keys; |
492 | | - $flipKeys = array_flip( $keys ); |
493 | 498 | |
494 | 499 | /* This removes messages from the list which have certain |
495 | 500 | * reviewer (among others) */ |
496 | 501 | $user = intval( $user ); |
497 | 502 | foreach ( $this->dbReviewData as $row ) { |
498 | 503 | if ( intval($row->trr_user) === $user ) { |
499 | | - $realKey = $flipKeys[$row->page_title]; |
500 | | - unset( $keys[$realKey] ); |
| 504 | + unset( $keys[$this->rowToKey( $row )] ); |
501 | 505 | } |
502 | 506 | } |
503 | 507 | |
— | — | @@ -517,13 +521,11 @@ |
518 | 522 | protected function filterLastTranslator( array $keys, /*bool*/ $condition, /*int*/ $user ) { |
519 | 523 | $this->loadData( $keys ); |
520 | 524 | $origKeys = $keys; |
521 | | - $flipKeys = array_flip( $keys ); |
522 | 525 | |
523 | 526 | $user = intval( $user ); |
524 | 527 | foreach ( $this->dbData as $row ) { |
525 | 528 | if ( intval($row->rev_user) === $user ) { |
526 | | - $realKey = $flipKeys[$row->page_title]; |
527 | | - unset( $keys[$realKey] ); |
| 529 | + unset( $keys[$this->rowToKey( $row )] ); |
528 | 530 | } |
529 | 531 | } |
530 | 532 | |
— | — | @@ -539,18 +541,20 @@ |
540 | 542 | * @param $keys \list{String} List of keys in display format. |
541 | 543 | * @return \arrayof{String,String} Array of keys in database format indexed by display format. |
542 | 544 | */ |
543 | | - protected function fixKeys( array $keys ) { |
| 545 | + protected function fixKeys() { |
544 | 546 | $newkeys = array(); |
545 | | - $namespace = $this->definitions->namespace; |
| 547 | + // array( namespace, pagename ) |
| 548 | + $pages = $this->definitions->getPages(); |
546 | 549 | $code = $this->code; |
547 | 550 | |
548 | | - foreach ( $keys as $key ) { |
549 | | - $title = Title::makeTitleSafe( $namespace, $key . '/' . $code ); |
| 551 | + foreach ( $pages as $key => $page ) { |
| 552 | + list ( $namespace, $pagename ) = $page; |
| 553 | + $title = Title::makeTitleSafe( $namespace, "$pagename/$code" ); |
550 | 554 | if ( !$title ) { |
551 | | - wfWarn( "Invalid title $namespace:$key/$code" ); |
| 555 | + wfWarn( "Invalid title $namespace:$pagename/$code" ); |
552 | 556 | continue; |
553 | 557 | } |
554 | | - $newkeys[$key] = $title->getDBKey(); |
| 558 | + $newkeys[$key] = $title; |
555 | 559 | } |
556 | 560 | return $newkeys; |
557 | 561 | } |
— | — | @@ -572,14 +576,10 @@ |
573 | 577 | } |
574 | 578 | |
575 | 579 | $dbr = wfGetDB( $dbtype ); |
576 | | - |
577 | 580 | $tables = array( 'page', 'revtag' ); |
578 | | - $fields = array( 'page_title', 'rt_type' ); |
579 | | - $conds = array( |
580 | | - 'page_namespace' => $this->definitions->namespace, |
581 | | - 'page_title' => array_values( $keys ), |
582 | | - ); |
583 | | - $joins = array( 'revtag' => |
| 581 | + $fields = array( 'page_namespace', 'page_title', 'rt_type' ); |
| 582 | + $conds = $this->getTitleConds( $dbr ); |
| 583 | + $joins = array( 'revtag' => |
584 | 584 | array( |
585 | 585 | 'LEFT JOIN', |
586 | 586 | array( 'page_id=rt_page', 'page_latest=rt_revision', 'rt_type' => RevTag::getType( 'fuzzy' ) ) |
— | — | @@ -606,14 +606,10 @@ |
607 | 607 | } |
608 | 608 | |
609 | 609 | $dbr = wfGetDB( $dbtype ); |
610 | | - |
611 | 610 | $tables = array( 'page', 'translate_reviews' ); |
612 | | - $fields = array( 'page_title', 'trr_user' ); |
613 | | - $conds = array( |
614 | | - 'page_namespace' => $this->definitions->namespace, |
615 | | - 'page_title' => array_values( $keys ), |
616 | | - ); |
617 | | - $joins = array( 'translate_reviews' => |
| 611 | + $fields = array( 'page_namespace', 'page_title', 'trr_user' ); |
| 612 | + $conds = $this->getTitleConds( $dbtype ); |
| 613 | + $joins = array( 'translate_reviews' => |
618 | 614 | array( |
619 | 615 | 'JOIN', |
620 | 616 | array( 'page_id=trr_page', 'page_latest=trr_revision' ) |
— | — | @@ -642,13 +638,12 @@ |
643 | 639 | $dbr = wfGetDB( $dbtype ); |
644 | 640 | |
645 | 641 | $tables = array( 'page', 'revision', 'text' ); |
646 | | - $fields = array( 'page_title', 'page_latest', 'rev_user', 'rev_user_text', 'old_flags', 'old_text' ); |
| 642 | + $fields = array( 'page_namespace', 'page_title', 'page_latest', 'rev_user', 'rev_user_text', 'old_flags', 'old_text' ); |
647 | 643 | $conds = array( |
648 | | - 'page_namespace' => $this->definitions->namespace, |
649 | | - 'page_title' => array_values( $keys ), |
650 | 644 | 'page_latest = rev_id', |
651 | 645 | 'old_id = rev_text_id', |
652 | 646 | ); |
| 647 | + $conds = array_merge( $conds, $this->getTitleConds( $dbr ) ); |
653 | 648 | |
654 | 649 | $res = $dbr->select( $tables, $fields, $conds, __METHOD__ ); |
655 | 650 | |
— | — | @@ -656,6 +651,63 @@ |
657 | 652 | } |
658 | 653 | |
659 | 654 | /** |
| 655 | + * Of the current set of keys, construct database query conditions. |
| 656 | + * @since 2011-12-28 |
| 657 | + */ |
| 658 | + protected function getTitleConds( $db ) { |
| 659 | + // Array of array( namespace, pagename ) |
| 660 | + $byNamespace = array(); |
| 661 | + foreach ( $this->getTitles() as $title ) { |
| 662 | + $namespace = $title->getNamespace(); |
| 663 | + $pagename = $title->getDBKey(); |
| 664 | + $byNamespace[$namespace][] = $pagename; |
| 665 | + } |
| 666 | + |
| 667 | + $conds = array(); |
| 668 | + foreach ( $byNamespace as $namespaces => $pagenames ) { |
| 669 | + $cond = array( |
| 670 | + 'page_namespace' => $namespaces, |
| 671 | + 'page_title' => $pagenames, |
| 672 | + ); |
| 673 | + |
| 674 | + $conds[] = $db->makeList( $cond, LIST_AND ); |
| 675 | + } |
| 676 | + return $conds; |
| 677 | + } |
| 678 | + |
| 679 | + /** |
| 680 | + * Given two-dimensional map of namespace and pagenames, this uses |
| 681 | + * database fields page_namespace and page_title as keys and returns |
| 682 | + * the value for those indexes. |
| 683 | + * @since 2011-12-23 |
| 684 | + */ |
| 685 | + protected function rowToKey( $row ) { |
| 686 | + $map = $this->getReverseMap(); |
| 687 | + if ( isset( $map[$row->page_namespace][$row->page_title] ) ) { |
| 688 | + return $map[$row->page_namespace][$row->page_title]; |
| 689 | + } else { |
| 690 | + wfWarn( "Got unknown title from the database: {$row->page_namespace}:{$row->page_title}" ); |
| 691 | + return null; |
| 692 | + } |
| 693 | + } |
| 694 | + |
| 695 | + /** |
| 696 | + * Creates a two-dimensional map of namespace and pagenames. |
| 697 | + * @since 2011-12-23 |
| 698 | + */ |
| 699 | + public function getReverseMap() { |
| 700 | + if ( isset( $this->reverseMap ) ) { |
| 701 | + return $this->reverseMap; |
| 702 | + } |
| 703 | + |
| 704 | + $map = array(); |
| 705 | + foreach ( $this->keys as $mkey => $title ) { |
| 706 | + $map[$title->getNamespace()][$title->getDBKey()] = $mkey; |
| 707 | + } |
| 708 | + return $this->reverseMap = $map; |
| 709 | + } |
| 710 | + |
| 711 | + /** |
660 | 712 | * Constructs all TMessages from the data accumulated so far. |
661 | 713 | * Usually there is no need to call this method directly. |
662 | 714 | */ |
— | — | @@ -665,35 +717,25 @@ |
666 | 718 | } |
667 | 719 | |
668 | 720 | $messages = array(); |
669 | | - |
670 | | - foreach ( array_keys( $this->keys ) as $key ) { |
671 | | - $messages[$key] = new ThinMessage( $key, $this->definitions->messages[$key] ); |
| 721 | + $definitions = $this->definitions->getDefinitions(); |
| 722 | + foreach ( array_keys( $this->keys ) as $mkey ) { |
| 723 | + $messages[$mkey] = new ThinMessage( $mkey, $definitions[$mkey] ); |
672 | 724 | } |
673 | 725 | |
674 | | - $flipKeys = array_flip( $this->keys ); |
675 | | - |
676 | 726 | // Copy rows if any. |
677 | 727 | if ( $this->dbData !== null ) { |
678 | 728 | foreach ( $this->dbData as $row ) { |
679 | | - if ( !isset( $flipKeys[$row->page_title] ) ) { |
680 | | - continue; |
681 | | - } |
682 | | - |
683 | | - $key = $flipKeys[$row->page_title]; |
684 | | - $messages[$key]->setRow( $row ); |
685 | | - $messages[$key]->setProperty( 'revision', $row->page_latest ); |
| 729 | + $mkey = $this->rowToKey( $row ); |
| 730 | + $messages[$mkey]->setRow( $row ); |
| 731 | + $messages[$mkey]->setProperty( 'revision', $row->page_latest ); |
686 | 732 | } |
687 | 733 | } |
688 | 734 | |
689 | 735 | if ( $this->dbInfo !== null ) { |
690 | 736 | $fuzzy = array(); |
691 | 737 | foreach ( $this->dbInfo as $row ) { |
692 | | - if ( !isset( $flipKeys[$row->page_title] ) ) { |
693 | | - continue; |
694 | | - } |
695 | | - |
696 | 738 | if ( $row->rt_type !== null ) { |
697 | | - $fuzzy[] = $flipKeys[$row->page_title]; |
| 739 | + $fuzzy[] = $this->rowToKey( $row ); |
698 | 740 | } |
699 | 741 | } |
700 | 742 | |
— | — | @@ -702,36 +744,33 @@ |
703 | 745 | |
704 | 746 | // Copy tags if any. |
705 | 747 | foreach ( $this->tags as $type => $keys ) { |
706 | | - foreach ( $keys as $key ) { |
707 | | - if ( isset( $messages[$key] ) ) { |
708 | | - $messages[$key]->setTag( $type ); |
| 748 | + foreach ( $keys as $mkey ) { |
| 749 | + if ( isset( $messages[$mkey] ) ) { |
| 750 | + $messages[$mkey]->setTag( $type ); |
709 | 751 | } |
710 | 752 | } |
711 | 753 | } |
712 | 754 | |
713 | 755 | // Copy properties if any. |
714 | 756 | foreach ( $this->properties as $type => $keys ) { |
715 | | - foreach ( $keys as $key => $value ) { |
716 | | - if ( isset( $messages[$key] ) ) { |
717 | | - $messages[$key]->setProperty( $type, $value ); |
| 757 | + foreach ( $keys as $mkey => $value ) { |
| 758 | + if ( isset( $messages[$mkey] ) ) { |
| 759 | + $messages[$mkey]->setProperty( $type, $value ); |
718 | 760 | } |
719 | 761 | } |
720 | 762 | } |
721 | 763 | |
722 | 764 | // Copy infile if any. |
723 | | - foreach ( $this->infile as $key => $value ) { |
724 | | - if ( isset( $messages[$key] ) ) { |
725 | | - $messages[$key]->setInfile( $value ); |
| 765 | + foreach ( $this->infile as $mkey => $value ) { |
| 766 | + if ( isset( $messages[$mkey] ) ) { |
| 767 | + $messages[$mkey]->setInfile( $value ); |
726 | 768 | } |
727 | 769 | } |
728 | 770 | |
729 | 771 | if ( $this->dbReviewData !== null ) { |
730 | 772 | foreach ( $this->dbReviewData as $row ) { |
731 | | - if ( !isset( $flipKeys[$row->page_title] ) ) { |
732 | | - continue; |
733 | | - } |
734 | | - $key = $flipKeys[$row->page_title]; |
735 | | - $messages[$key]->appendProperty( 'reviewers', $row->trr_user ); |
| 773 | + $mkey = $this->rowToKey( $row ); |
| 774 | + $messages[$mkey]->appendProperty( 'reviewers', $row->trr_user ); |
736 | 775 | } |
737 | 776 | } |
738 | 777 | |
— | — | @@ -820,14 +859,36 @@ |
821 | 860 | |
822 | 861 | /** |
823 | 862 | * Wrapper for message definitions, just to beauty the code. |
824 | | - * This is one reason why message collections and thus message groups are |
825 | | - * restricted into single namespace. |
| 863 | + * |
| 864 | + * API totally changed in 2011-12-28 |
826 | 865 | */ |
827 | 866 | class MessageDefinitions { |
828 | | - public $namespace; |
829 | | - public $messages; |
830 | | - public function __construct( $namespace, array $messages ) { |
| 867 | + protected $namespace; |
| 868 | + protected $messages; |
| 869 | + |
| 870 | + public function __construct( array $messages, $namespace = false ) { |
831 | 871 | $this->namespace = $namespace; |
832 | 872 | $this->messages = $messages; |
833 | 873 | } |
| 874 | + |
| 875 | + public function getDefinitions() { |
| 876 | + return $this->messages; |
| 877 | + } |
| 878 | + |
| 879 | + /** |
| 880 | + * @return Array of Array( namespace, pagename ) |
| 881 | + */ |
| 882 | + public function getPages() { |
| 883 | + $namespace = $this->namespace; |
| 884 | + $pages = array(); |
| 885 | + foreach ( array_keys( $this->messages ) as $key ) { |
| 886 | + if ( $namespace === false ) { |
| 887 | + // pages are in format ex. "8:jan" |
| 888 | + $pages[$key] = explode( $key, ':', 2 ); |
| 889 | + } else { |
| 890 | + $pages[$key] = array( $namespace, $key ); |
| 891 | + } |
| 892 | + } |
| 893 | + return $pages; |
| 894 | + } |
834 | 895 | } |
Index: trunk/extensions/Translate/MessageGroups.php |
— | — | @@ -254,7 +254,7 @@ |
255 | 255 | $definitions = $this->getUniqueDefinitions(); |
256 | 256 | } |
257 | 257 | |
258 | | - $defs = new MessageDefinitions( $this->namespaces[0], $definitions ); |
| 258 | + $defs = new MessageDefinitions( $definitions, $this->namespaces[0] ); |
259 | 259 | $collection = MessageCollection::newFromDefinitions( $defs, $code ); |
260 | 260 | |
261 | 261 | $bools = $this->getBools(); |
— | — | @@ -624,7 +624,7 @@ |
625 | 625 | $this->fill( $collection ); |
626 | 626 | $this->fillContents( $collection ); |
627 | 627 | |
628 | | - foreach ( array_keys( $collection->keys() ) as $key ) { |
| 628 | + foreach ( $collection->getMessageKeys() as $key ) { |
629 | 629 | if ( $collection[$key]->translation() === null ) { |
630 | 630 | unset( $collection[$key] ); |
631 | 631 | } |
— | — | @@ -635,7 +635,7 @@ |
636 | 636 | |
637 | 637 | function fill( MessageCollection $messages ) { |
638 | 638 | $cache = $this->load( $messages->code ); |
639 | | - foreach ( array_keys( $messages->keys() ) as $key ) { |
| 639 | + foreach ( $messages->getMessageKeys() as $key ) { |
640 | 640 | if ( isset( $cache[$key] ) ) { |
641 | 641 | if ( is_array( $cache[$key] ) ) { |
642 | 642 | $messages[$key]->setInfile( implode( ',', $cache[$key] ) ); |
Index: trunk/extensions/Translate/TranslateEditAddons.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | $code = $handle->getCode(); |
42 | 42 | $collection = $group->initCollection( $group->getSourceLanguage() ); |
43 | 43 | $collection->filter( 'optional' ); |
44 | | - $keys = array_keys( $collection->keys() ); |
| 44 | + $keys = $collection->getMessageKeys(); |
45 | 45 | $count = count( $keys ); |
46 | 46 | |
47 | 47 | $key = strtolower( strtr( $key, ' ', '_' ) ); |
Index: trunk/extensions/Translate/TranslateTasks.php |
— | — | @@ -282,7 +282,7 @@ |
283 | 283 | |
284 | 284 | $start = time(); |
285 | 285 | |
286 | | - foreach ( $this->collection->keys() as $key => $_ ) { |
| 286 | + foreach ( $this->collection->getMessageKeys() as $key ) { |
287 | 287 | // Allow up to 10 seconds to search for suggestions. |
288 | 288 | if ( time() - $start > 10 || TranslationHelpers::checkTranslationServiceFailure( 'tmserver' ) ) { |
289 | 289 | unset( $this->collection[$key] ); |
Index: trunk/extensions/Translate/utils/MessageTable.php |
— | — | @@ -61,12 +61,11 @@ |
62 | 62 | public function includeAssets() { |
63 | 63 | global $wgOut; |
64 | 64 | TranslationHelpers::addModules( $wgOut ); |
65 | | - $keys = array(); |
66 | | - $namespace = $this->group->getNamespace(); |
67 | | - foreach ( array_values( $this->collection->keys() ) as $name ) { |
68 | | - $keys[] = Title::makeTitle( $namespace, $name )->getPrefixedDbKey(); |
| 65 | + $pages = array(); |
| 66 | + foreach ( $this->collection->getTitles() as $title ) { |
| 67 | + $pages[] = $title->getPrefixedDBKey(); |
69 | 68 | } |
70 | | - $vars = array( 'trlKeys' => $keys ); |
| 69 | + $vars = array( 'trlKeys' => $pages ); |
71 | 70 | $wgOut->addScript( Skin::makeVariablesScript( $vars ) ); |
72 | 71 | $wgOut->addModules( 'ext.translate.messagetable' ); |
73 | 72 | } |
— | — | @@ -273,9 +272,8 @@ |
274 | 273 | protected function doLinkBatch() { |
275 | 274 | $batch = new LinkBatch(); |
276 | 275 | $batch->setCaller( __METHOD__ ); |
277 | | - $ns = $this->group->getNamespace(); |
278 | | - foreach ( $this->collection->keys() as $key ) { |
279 | | - $batch->add( $ns, $key ); |
| 276 | + foreach ( $this->collection->getTitles() as $title ) { |
| 277 | + $batch->addObj( $title ); |
280 | 278 | } |
281 | 279 | $batch->execute(); |
282 | 280 | } |
Index: trunk/extensions/Translate/utils/MessageWebImporter.php |
— | — | @@ -281,7 +281,7 @@ |
282 | 282 | |
283 | 283 | if ( !$process ) { |
284 | 284 | $collection->filter( 'hastranslation', false ); |
285 | | - $keys = array_keys( $collection->keys() ); |
| 285 | + $keys = $collection->getMessageKeys(); |
286 | 286 | |
287 | 287 | $diff = array_diff( $keys, array_keys( $messages ) ); |
288 | 288 | |
Index: trunk/extensions/Translate/specials/SpecialManageGroups.php |
— | — | @@ -349,7 +349,7 @@ |
350 | 350 | |
351 | 351 | if ( !$process ) { |
352 | 352 | $collection->filter( 'hastranslation', false ); |
353 | | - $keys = array_keys( $collection->keys() ); |
| 353 | + $keys = $collection->getMessageKeys(); |
354 | 354 | |
355 | 355 | $diff = array_diff( $keys, array_keys( $messages ) ); |
356 | 356 | |
Index: trunk/extensions/Translate/Groups.php |
— | — | @@ -254,7 +254,7 @@ |
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | | - $definitions = new MessageDefinitions( $namespace, $messages ); |
| 258 | + $definitions = new MessageDefinitions( $messages, $namespace ); |
259 | 259 | $collection = MessageCollection::newFromDefinitions( $definitions, $code ); |
260 | 260 | $this->setTags( $collection ); |
261 | 261 | |
— | — | @@ -666,7 +666,7 @@ |
667 | 667 | } |
668 | 668 | |
669 | 669 | $namespace = $this->getNamespace(); |
670 | | - $definitions = new MessageDefinitions( $namespace, $messages ); |
| 670 | + $definitions = new MessageDefinitions( $messages, $namespace ); |
671 | 671 | $collection = MessageCollection::newFromDefinitions( $definitions, $code ); |
672 | 672 | |
673 | 673 | $this->setTags( $collection ); |
Index: trunk/extensions/Translate/api/ApiQueryMessageCollection.php |
— | — | @@ -69,21 +69,21 @@ |
70 | 70 | $count = 0; |
71 | 71 | |
72 | 72 | $props = array_flip( $params['prop'] ); |
73 | | - foreach ( $messages->keys() as $key => $dbkey ) { |
| 73 | + foreach ( $messages->keys() as $mkey => $title ) { |
74 | 74 | if ( ++$count > $params['limit'] ) { |
75 | 75 | $this->setContinueEnumParameter( 'offset', $params['offset'] + $count - 1 ); |
76 | 76 | break; |
77 | 77 | } |
78 | 78 | |
79 | 79 | if ( is_null( $resultPageSet ) ) { |
80 | | - $data = $this->extractMessageData( $result, $props, $messages[$key] ); |
| 80 | + $data = $this->extractMessageData( $result, $props, $messages[$mkey] ); |
81 | 81 | $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $data ); |
82 | 82 | if ( !$fit ) { |
83 | 83 | $this->setContinueEnumParameter( 'offset', $params['offset'] + $count - 1 ); |
84 | 84 | break; |
85 | 85 | } |
86 | 86 | } else { |
87 | | - $pages[] = Title::makeTitleSafe( $group->getNamespace(), $dbkey ); |
| 87 | + $pages[] = $title; |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |