r107494 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107493‎ | r107494 | r107495 >
Date:14:29, 28 December 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Followup r107486: explode params in wrong order, conds should be OR and since keys do not map to titles directly anymore, use other way of getting the title in MessageTable
Modified paths:
  • /trunk/extensions/Translate/MessageCollection.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageTable.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageCollection.php
@@ -643,7 +643,7 @@
644644 'page_latest = rev_id',
645645 'old_id = rev_text_id',
646646 );
647 - $conds = array_merge( $conds, $this->getTitleConds( $dbr ) );
 647+ $conds[] = $this->getTitleConds( $dbr );
648648
649649 $res = $dbr->select( $tables, $fields, $conds, __METHOD__ );
650650
@@ -672,7 +672,7 @@
673673
674674 $conds[] = $db->makeList( $cond, LIST_AND );
675675 }
676 - return $conds;
 676+ return $db->makeList( $conds, LIST_OR );
677677 }
678678
679679 /**
@@ -884,7 +884,7 @@
885885 foreach ( array_keys( $this->messages ) as $key ) {
886886 if ( $namespace === false ) {
887887 // pages are in format ex. "8:jan"
888 - $pages[$key] = explode( $key, ':', 2 );
 888+ $pages[$key] = explode( ':', $key, 2 );
889889 } else {
890890 $pages[$key] = array( $namespace, $key );
891891 }
Index: trunk/extensions/Translate/utils/MessageTable.php
@@ -104,13 +104,14 @@
105105
106106 $sourceLang = Language::factory( $this->group->getSourceLanguage() );
107107 $targetLang = Language::factory( $this->collection->getLanguage() );
 108+ $titleMap = $this->collection->keys();
108109
109110 $output = '';
110111
111112 $this->collection->initMessages(); // Just to be sure
112113 foreach ( $this->collection as $key => $m ) {
113114 $tools = array();
114 - $title = $this->keyToTitle( $key );
 115+ $title = $titleMap[$key];
115116
116117 $original = $m->definition();
117118
@@ -189,13 +190,6 @@
190191 }
191192 }
192193
193 - protected function keyToTitle( $key ) {
194 - $titleText = TranslateUtils::title( $key, $this->collection->code );
195 - $namespace = $this->group->getNamespace();
196 -
197 - return Title::makeTitle( $namespace, $titleText );
198 - }
199 -
200194 protected static function getLanguageAttributes( Language $language ) {
201195 global $wgTranslateDocumentationLanguageCode;
202196 $code = $language->getCode();

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107486I18n #347: Refactor backend to support messages from multiple namespacesnikerabbit13:01, 28 December 2011

Status & tagging log