Index: trunk/extensions/Translate/scripts/export.php |
— | — | @@ -22,6 +22,9 @@ |
23 | 23 | --lang Comma separated list of language codes or * |
24 | 24 | --group Group ID |
25 | 25 | --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 |
26 | 29 | EOT |
27 | 30 | ); |
28 | 31 | exit( 1 ); |
— | — | @@ -79,9 +82,38 @@ |
80 | 83 | $ffs->setWritePath( $options['target'] ); |
81 | 84 | $collection = $group->initCollection( 'en' ); |
82 | 85 | |
| 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 | + |
83 | 98 | foreach ( $langs as $lang ) { |
84 | 99 | $collection->resetForNewLanguage( $lang ); |
85 | 100 | $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 | + } |
86 | 118 | } |
87 | 119 | } else { |
88 | 120 | $writer = $group->getWriter(); |