r36937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36936‎ | r36937 | r36938 >
Date:18:44, 2 July 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* Fix export bugs
Modified paths:
  • /trunk/extensions/Translate/SpecialMagic.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/SpecialMagic.php
@@ -255,10 +255,11 @@
256256 if ( $name === '' || $values === '' ) continue;
257257
258258 $data = array_map( 'trim', explode( ',', $values ) );
259 - $array[$name] = $values;
 259+ $array[$name] = $data;
260260
261261 }
262262
 263+
263264 return $array;
264265 }
265266
@@ -444,12 +445,16 @@
445446 $text = '';
446447
447448 foreach ( $groups as $group => $data ) {
448 - $text .= "# $group \n";
449449
450450 $var = $data['var'];
451451 $items = $data['data'];
452452
453 - $text .= "\$$var = array(\n";
 453+ $extra = '';
 454+ if ( $data['code'] ) {
 455+ $extra = "['{$this->language}']";
 456+ }
 457+
 458+ $out = '';
454459 $padTo = max(array_map( 'strlen', array_keys($items[self::LANG_MASTER]) )) +3;
455460
456461 foreach ( $this->getIterator($group) as $key ) {
@@ -464,10 +469,13 @@
465470 } else {
466471 $temp .= "=> " . implode( ', ', $normalized ) . ",";
467472 }
468 - $text .= $temp . "\n";
 473+ $out .= $temp . "\n";
469474 }
470475
471 - $text .= ");\n\n";
 476+ if ( $out !== '' ) {
 477+ $text .= "# $group \n";
 478+ $text .= "\$$var$extra = array(\n" . $out . ");\n\n";
 479+ }
472480
473481 }
474482

Status & tagging log