http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73825

Revision: 73825
Author:   siebrand
Date:     2010-09-27 21:28:14 +0000 (Mon, 27 Sep 2010)

Log Message:
-----------
Allow rebuilding export of gettext files against a more recent target.

Modified Paths:
--------------
    trunk/extensions/Translate/scripts/export.php

Modified: trunk/extensions/Translate/scripts/export.php
===================================================================
--- trunk/extensions/Translate/scripts/export.php       2010-09-27 20:19:22 UTC 
(rev 73824)
+++ trunk/extensions/Translate/scripts/export.php       2010-09-27 21:28:14 UTC 
(rev 73825)
@@ -22,6 +22,9 @@
   --lang        Comma separated list of language codes or *
   --group       Group ID
   --threshold   Do not export under this percentage translated
+  --ppgettext   Group root path for checkout of product. "msgmerge" will post
+                process on the export result based on the current 
definitionFile
+                in that location
 EOT
 );
        exit( 1 );
@@ -79,9 +82,38 @@
        $ffs->setWritePath( $options['target'] );
        $collection = $group->initCollection( 'en' );
 
+       $definitionFile = false;
+
+       if ( isset( $options['ppgettext'] ) && $ffs instanceof GettextFFS ) {
+               global $wgMaxShellMemory;
+
+               // Need more shell memory for msgmerge.
+               $wgMaxShellMemory = 302400;
+
+               $conf = $group->getConfiguration();
+               $definitionFile = str_replace( '%GROUPROOT%', 
$options['ppgettext'], $conf['FILES']['definitionFile'] );
+       }
+
        foreach ( $langs as $lang ) {
                $collection->resetForNewLanguage( $lang );
                $ffs->write( $collection );
+
+               // Do post processing if requested.
+               if ( $definitionFile ) {
+                       if ( is_file( $definitionFile ) ) {
+                               $targetFileName = $ffs->getWritePath() . 
$group->getTargetFilename( $collection->code );
+                               $cmd = "msgmerge --update --backup=off " . 
$targetFileName . ' ' . $definitionFile;
+                               wfShellExec( $cmd, $ret );
+
+                               // Report on errors.
+                               if ( $ret ) {
+                                       STDERR( 'ERROR: ' . $ret );
+                               }
+                       } else {
+                               STDERR( $definitionFile . ' does not exist.' );
+                               exit( 1 );
+                       }
+               }
        }
 } else {
        $writer = $group->getWriter();



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to