Index: trunk/extensions/Translate/FFS.php |
— | — | @@ -447,38 +447,44 @@ |
448 | 448 | ); |
449 | 449 | } |
450 | 450 | |
451 | | - public function writeIntoVariable( MessageCollection $collection ) { |
452 | | - $r = $this->header( $collection->code, $collection->getAuthors() ); |
| 451 | + public function writeReal( MessageCollection $collection ) { |
| 452 | + $header = $this->header( $collection->code, $collection->getAuthors() ); |
453 | 453 | |
454 | 454 | $mangler = $this->group->getMangler(); |
455 | 455 | |
456 | 456 | // Get and write messages. |
| 457 | + $body = ''; |
457 | 458 | foreach ( $collection as $message ) { |
| 459 | + if( strlen( $message->translation() ) === 0 ) continue; |
| 460 | + |
458 | 461 | $key = $mangler->unmangle( $message->key() ); |
459 | 462 | $key = $this->transformKey( Xml::escapeJsString( $key ) ); |
460 | 463 | |
461 | 464 | $translation = Xml::escapeJsString( $message->translation() ); |
462 | 465 | |
463 | | - $r .= " {$key}: \"{$translation}\",\n\n"; |
| 466 | + $body .= " {$key}: \"{$translation}\",\n\n"; |
464 | 467 | } |
465 | 468 | |
| 469 | + if( strlen( $body ) === 0 ) return false; |
| 470 | + |
466 | 471 | // Strip last comma, re-add trailing newlines. |
467 | | - $r = substr( $r, 0, - 3 ); |
468 | | - $r .= "\n\n"; |
| 472 | + $body = substr( $body, 0, - 3 ); |
| 473 | + $body .= "\n\n"; |
469 | 474 | |
470 | | - return $r . $this->footer(); |
| 475 | + return $header . $body . $this->footer(); |
471 | 476 | } |
472 | 477 | |
473 | 478 | protected function authorsList( $authors ) { |
474 | 479 | if( count( $authors ) === 0 ) return ''; |
475 | 480 | |
| 481 | + $authorsList = ''; |
476 | 482 | foreach ( $authors as $author ) { |
477 | 483 | $authorsList .= " * - $author\n"; |
478 | 484 | } |
479 | 485 | return "/* Translators:\n$authorsList */\n\n"; |
480 | 486 | } |
481 | 487 | |
482 | | - private static function unescapeJsString( $string ) { |
| 488 | + protected static function unescapeJsString( $string ) { |
483 | 489 | // See ECMA 262 section 7.8.4 for string literal format |
484 | 490 | $pairs = array( |
485 | 491 | "\\" => "\\\\", |