Index: trunk/extensions/Translate/scripts/export.php |
— | — | @@ -3,12 +3,13 @@ |
4 | 4 | * Script to export translations of one message group to file(s). |
5 | 5 | * |
6 | 6 | * @author Niklas Laxstrom |
7 | | - * @copyright Copyright © 2008-2010, Niklas Laxström |
| 7 | + * @author Siebrand Mazeland |
| 8 | + * @copyright Copyright © 2008-2010, Niklas Laxström, Siebrand Mazeland |
8 | 9 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
9 | 10 | * @file |
10 | 11 | */ |
11 | 12 | |
12 | | -$optionsWithArgs = array( 'lang', 'target', 'group', 'threshold' ); |
| 13 | +$optionsWithArgs = array( 'lang', 'skip', 'target', 'group', 'threshold', 'ppgettext' ); |
13 | 14 | require( dirname( __FILE__ ) . '/cli.inc' ); |
14 | 15 | |
15 | 16 | function showUsage() { |
— | — | @@ -20,6 +21,7 @@ |
21 | 22 | Options: |
22 | 23 | --target Target directory for exported files |
23 | 24 | --lang Comma separated list of language codes or * |
| 25 | + --skip Languages to skip, comma separated list |
24 | 26 | --group Group ID |
25 | 27 | --threshold Do not export under this percentage translated |
26 | 28 | --ppgettext Group root path for checkout of product. "msgmerge" will post |
— | — | @@ -44,6 +46,12 @@ |
45 | 47 | exit( 1 ); |
46 | 48 | } |
47 | 49 | |
| 50 | +if ( isset( $options['skip'] ) ) { |
| 51 | + $skip = array_map( 'trim', explode( ',', $options['skip'] ) ); |
| 52 | +} else { |
| 53 | + $skip = array(); |
| 54 | +} |
| 55 | + |
48 | 56 | if ( !isset( $options['group'] ) ) { |
49 | 57 | STDERR( "You need to specify group" ); |
50 | 58 | exit( 1 ); |
— | — | @@ -95,6 +103,11 @@ |
96 | 104 | } |
97 | 105 | |
98 | 106 | foreach ( $langs as $lang ) { |
| 107 | + // Do not export if language code is to be skipped. |
| 108 | + if( in_array( $lang, $skip ) { |
| 109 | + continue; |
| 110 | + } |
| 111 | + |
99 | 112 | $collection->resetForNewLanguage( $lang ); |
100 | 113 | $ffs->write( $collection ); |
101 | 114 | |
— | — | @@ -102,7 +115,7 @@ |
103 | 116 | if ( $definitionFile ) { |
104 | 117 | if ( is_file( $definitionFile ) ) { |
105 | 118 | $targetFileName = $ffs->getWritePath() . $group->getTargetFilename( $collection->code ); |
106 | | - $cmd = "msgmerge --update --backup=off " . $targetFileName . ' ' . $definitionFile; |
| 119 | + $cmd = "msgmerge --quiet --update --backup=off " . $targetFileName . ' ' . $definitionFile; |
107 | 120 | wfShellExec( $cmd, $ret ); |
108 | 121 | |
109 | 122 | // Report on errors. |