http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72855
Revision: 72855 Author: nikerabbit Date: 2010-09-12 12:02:57 +0000 (Sun, 12 Sep 2010) Log Message: ----------- Improve tag/flag handling and clean up the code a bit 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:49:49 UTC (rev 72854) +++ trunk/extensions/Translate/ffs/Gettext.php 2010-09-12 12:02:57 UTC (rev 72855) @@ -626,13 +626,23 @@ $template = $this->read( $collection->code ); $output = $this->doGettextHeader( $collection, $template ); foreach ( $collection as $key => $m ) { + $transTemplate = isset( $template['TEMPLATE'][$key] ) ? + $template['TEMPLATE'][$key] : array(); + $potTemplate = isset( $pot['TEMPLATE'][$key] ) ? + $pot['TEMPLATE'][$key] : array(); + $tags = $m->getTags(); - if ( $tags ) { - $output .= "#, " . implode( ', ', $tags ) . "\n"; + $flags = isset( $transTemplate['flags'] ) ? $transTemplate['flags'] : array(); + + $outFlags = array_unique( array_merge( $tags, $flags ) ); + + if ( $outFlags ) { + sort( $outFlags ); + $output .= "#, " . implode( ', ', $outFlags ) . "\n"; } - if ( isset( $pot['TEMPLATE'][$key]['msgctxt'] ) ) { - $output .= 'msgctxt ' . self::escape( $pot['TEMPLATE'][$key]['msgctxt'] ) . "\n"; + if ( isset( $potTemplate['msgctxt'] ) ) { + $output .= 'msgctxt ' . self::escape( $potTemplate['msgctxt'] ) . "\n"; } $translation = str_replace( TRANSLATE_FUZZY, '', $m->translation() ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs