r73825 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73824‎ | r73825 | r73826 >
Date:21:28, 27 September 2010
Author:siebrand
Status:deferred (Comments)
Tags:
Comment:
Allow rebuilding export of gettext files against a more recent target.
Modified paths:
  • /trunk/extensions/Translate/scripts/export.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/scripts/export.php
@@ -22,6 +22,9 @@
2323 --lang Comma separated list of language codes or *
2424 --group Group ID
2525 --threshold Do not export under this percentage translated
 26+ --ppgettext Group root path for checkout of product. "msgmerge" will post
 27+ process on the export result based on the current definitionFile
 28+ in that location
2629 EOT
2730 );
2831 exit( 1 );
@@ -79,9 +82,38 @@
8083 $ffs->setWritePath( $options['target'] );
8184 $collection = $group->initCollection( 'en' );
8285
 86+ $definitionFile = false;
 87+
 88+ if ( isset( $options['ppgettext'] ) && $ffs instanceof GettextFFS ) {
 89+ global $wgMaxShellMemory;
 90+
 91+ // Need more shell memory for msgmerge.
 92+ $wgMaxShellMemory = 302400;
 93+
 94+ $conf = $group->getConfiguration();
 95+ $definitionFile = str_replace( '%GROUPROOT%', $options['ppgettext'], $conf['FILES']['definitionFile'] );
 96+ }
 97+
8398 foreach ( $langs as $lang ) {
8499 $collection->resetForNewLanguage( $lang );
85100 $ffs->write( $collection );
 101+
 102+ // Do post processing if requested.
 103+ if ( $definitionFile ) {
 104+ if ( is_file( $definitionFile ) ) {
 105+ $targetFileName = $ffs->getWritePath() . $group->getTargetFilename( $collection->code );
 106+ $cmd = "msgmerge --update --backup=off " . $targetFileName . ' ' . $definitionFile;
 107+ wfShellExec( $cmd, $ret );
 108+
 109+ // Report on errors.
 110+ if ( $ret ) {
 111+ STDERR( 'ERROR: ' . $ret );
 112+ }
 113+ } else {
 114+ STDERR( $definitionFile . ' does not exist.' );
 115+ exit( 1 );
 116+ }
 117+ }
86118 }
87119 } else {
88120 $writer = $group->getWriter();

Comments

#Comment by Brion VIBBER (talk | contribs)   03:28, 28 September 2010

--ppgettext was missing from $options def, but added in r73826 so no worries.

Status & tagging log