r51218 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51217‎ | r51218 | r51219 >
Date:08:21, 31 May 2009
Author:nikerabbit
Status:ok
Tags:
Comment:
Really fix alias export (hopyfully)
Modified paths:
  • /trunk/extensions/Translate/Message.php (modified) (history)
  • /trunk/extensions/Translate/MessageCollection.php (modified) (history)
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)
  • /trunk/extensions/Translate/scripts/createCheckIndex.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageCollection.php
@@ -377,7 +377,7 @@
378378 }
379379
380380 public function offsetSet( $offset, $value ) {
381 - throw new MWException( "Cannot add or modify elements" );
 381+ $this->messages[$offset] = $value;
382382 }
383383
384384 public function offsetUnset( $offset ) {
Index: trunk/extensions/Translate/scripts/createCheckIndex.php
@@ -76,7 +76,7 @@
7777 }
7878
7979 // Add it to the array
80 - $problematic[] = array( $g->namespaces[0], $key );
 80+ $problematic[] = array( $g->namespaces[0], "$key/$code" );
8181 }
8282 }
8383
@@ -88,6 +88,7 @@
8989 function tagFuzzy( $problematic ) {
9090 if ( !count($problematic) ) return;
9191
 92+
9293 $db = wfGetDB( DB_MASTER );
9394 $id = $db->selectField( 'revtag_type', 'rtt_id', array( 'rtt_name' => 'fuzzy' ), __METHOD__ );
9495 foreach ( $problematic as $p ) {
Index: trunk/extensions/Translate/Message.php
@@ -18,6 +18,7 @@
1919 public function key() { return $this->key; }
2020 public function definition() { return $this->definition; }
2121 abstract public function translation();
 22+ abstract public function author();
2223 }
2324
2425 class ThinMessage extends TMessage {
@@ -72,4 +73,6 @@
7374 public function translation() {
7475 return $this->translation;
7576 }
 77+
 78+ public function author() {}
7679 }
\ No newline at end of file
Index: trunk/extensions/Translate/MessageGroups.php
@@ -362,8 +362,9 @@
363363 }
364364
365365 class AliasMessageGroup extends ExtensionMessageGroup {
366 - public function initCollection( $code ) {
367 - $collection = array();
 366+ public function initCollection( $code, $unique = false ) {
 367+ $collection = parent::initCollection( $code, $unique );
 368+
368369 $defs = $this->load( 'en' );
369370 foreach ( $defs as $key => $value ) {
370371 $collection[$key] = new FatMessage( $key, implode( ", ", $value ) );
@@ -373,20 +374,20 @@
374375 return $collection;
375376 }
376377
377 - public function fillCollection( $collection ) {
 378+ public function fillCollection( MessageCollection $collection ) {
378379 $this->fill( $collection );
379380 $this->fillContents( $collection );
380381 }
381382
382383
383 - function fill( $messages ) {
 384+ function fill( MessageCollection $messages ) {
384385 $cache = $this->load( $messages->code );
385386 foreach ( $messages->keys() as $key ) {
386387 if ( isset( $cache[$key] ) ) {
387388 if ( is_array( $cache[$key] ) ) {
388 - $messages[$key]->infile = implode( ',', $cache[$key] );
 389+ $messages[$key]->setInfile( implode( ',', $cache[$key] ) );
389390 } else {
390 - $messages[$key]->infile = $cache[$key];
 391+ $messages[$key]->setInfile( $cache[$key] );
391392 }
392393 }
393394 }
@@ -407,7 +408,7 @@
408409 if ( $name === '' || $values === '' ) continue;
409410
410411 if ( isset( $collection[$name] ) ) {
411 - $collection[$name]->database = $values;
 412+ $collection[$name]->setTranslation( $values );
412413 }
413414 }
414415 }

Status & tagging log