r72849 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72848‎ | r72849 | r72850 >
Date:10:39, 12 September 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Read pot and previous translation file if available and use plural header form latter if avaiblable
Modified paths:
  • /trunk/extensions/Translate/Groups.php (modified) (history)
  • /trunk/extensions/Translate/ffs/Gettext.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Groups.php
@@ -209,9 +209,13 @@
210210 $messages = array();
211211
212212 $cache = new MessageGroupCache( $this );
213 -
214 - foreach ( $cache->getKeys() as $key ) {
215 - $messages[$key] = $cache->get( $key );
 213+ if ( !$cache->exists() ) {
 214+ wfWarn( "By-passing message group cache" );
 215+ $messages = $this->load( 'en' );
 216+ } else {
 217+ foreach ( $cache->getKeys() as $key ) {
 218+ $messages[$key] = $cache->get( $key );
 219+ }
216220 }
217221
218222 $definitions = new MessageDefinitions( $namespace, $messages );
Index: trunk/extensions/Translate/ffs/Gettext.php
@@ -625,7 +625,9 @@
626626 // WRITE
627627 //
628628 protected function writeReal( MessageCollection $collection ) {
629 - $output = $this->doHeader( $collection );
 629+ $pot = $this->read( 'en' );
 630+ $template = $this->read( $collection->code );
 631+ $output = $this->doGettextHeader( $collection, $template );
630632
631633 $mangler = $this->group->getMangler();
632634 $messages = array();
@@ -646,7 +648,7 @@
647649 return $output;
648650 }
649651
650 - protected function doHeader( MessageCollection $collection ) {
 652+ protected function doGettextHeader( MessageCollection $collection, $template ) {
651653 global $wgSitename, $wgServer;
652654 $code = $collection->code;
653655 $name = TranslateUtils::getLanguageName( $code );
@@ -669,10 +671,10 @@
670672 /// @todo twn specific
671673 $portal = Title::makeTitle( NS_PORTAL, $code )->getFullUrl();
672674
673 - $specs = array();
 675+ $specs = isset( $template['HEADERS'] ) ? $template['HEADERS'] : array();
674676
675677 $specs['Project-Id-Version'] = $this->group->getLabel();
676 - $specs['Report-Msgid-Bugs'] = $wgSitename;
 678+ $specs['Report-Msgid-Bugs-To'] = $wgSitename;
677679 $specs['POT-Creation-Date'] = self::formatTime( $this->getPotTime() );
678680 $specs['PO-Revision-Date'] = self::formatTime( wfTimestampNow() );
679681 $specs['Language-Team'] = "$name <$portal>";

Status & tagging log