http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72852
Revision: 72852 Author: nikerabbit Date: 2010-09-12 11:37:12 +0000 (Sun, 12 Sep 2010) Log Message: ----------- Bare minimum for Gettext exporter: msg(ctxt,id,str) + flags Modified Paths: -------------- trunk/extensions/Translate/ffs/Gettext.php Modified: trunk/extensions/Translate/ffs/Gettext.php =================================================================== --- trunk/extensions/Translate/ffs/Gettext.php 2010-09-12 11:35:28 UTC (rev 72851) +++ trunk/extensions/Translate/ffs/Gettext.php 2010-09-12 11:37:12 UTC (rev 72852) @@ -621,30 +621,26 @@ return $tags; } - // - // WRITE - // protected function writeReal( MessageCollection $collection ) { $pot = $this->read( 'en' ); $template = $this->read( $collection->code ); $output = $this->doGettextHeader( $collection, $template ); - - $mangler = $this->group->getMangler(); - $messages = array(); foreach ( $collection as $key => $m ) { - $key = $mangler->unmangle( $key ); - $value = $m->translation(); - $value = str_replace( TRANSLATE_FUZZY, '', $value ); + $tags = $m->getTags(); + if ( $tags ) { + $output .= "#, " . implode( ', ', $tags ) . "\n"; + } - if ( $value === '' ) { - continue; + if ( isset( $pot['TEMPLATE'][$key]['msgctxt'] ) ) { + $output .= 'msgctxt ' . self::escape( $pot['TEMPLATE'][$key]['msgctxt'] ) . "\n"; } - $messages[$key] = $value; + $translation = str_replace( TRANSLATE_FUZZY, '', $m->translation() ); + + $output .= 'msgid ' . self::escape( $m->definition() ) . "\n"; + $output .= 'msgstr ' . self::escape( $translation ) . "\n\n"; } - $output .= TranslateYaml::dump( $messages ); - return $output; } @@ -694,6 +690,7 @@ $output .= self::escape( "$k: $v\n" ) . "\n"; } + $output .= "\n"; return $output; } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs