r73826 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73825‎ | r73826 | r73827 >
Date:21:37, 27 September 2010
Author:siebrand
Status:resolved
Tags:
Comment:
* add parameter 'skip' to make it possible to export * but not 'en' and 'qqq' for example.
* execute msgmerge --quiet
Modified paths:
  • /trunk/extensions/Translate/scripts/export.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/scripts/export.php
@@ -3,12 +3,13 @@
44 * Script to export translations of one message group to file(s).
55 *
66 * @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
89 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
910 * @file
1011 */
1112
12 -$optionsWithArgs = array( 'lang', 'target', 'group', 'threshold' );
 13+$optionsWithArgs = array( 'lang', 'skip', 'target', 'group', 'threshold', 'ppgettext' );
1314 require( dirname( __FILE__ ) . '/cli.inc' );
1415
1516 function showUsage() {
@@ -20,6 +21,7 @@
2122 Options:
2223 --target Target directory for exported files
2324 --lang Comma separated list of language codes or *
 25+ --skip Languages to skip, comma separated list
2426 --group Group ID
2527 --threshold Do not export under this percentage translated
2628 --ppgettext Group root path for checkout of product. "msgmerge" will post
@@ -44,6 +46,12 @@
4547 exit( 1 );
4648 }
4749
 50+if ( isset( $options['skip'] ) ) {
 51+ $skip = array_map( 'trim', explode( ',', $options['skip'] ) );
 52+} else {
 53+ $skip = array();
 54+}
 55+
4856 if ( !isset( $options['group'] ) ) {
4957 STDERR( "You need to specify group" );
5058 exit( 1 );
@@ -95,6 +103,11 @@
96104 }
97105
98106 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+
99112 $collection->resetForNewLanguage( $lang );
100113 $ffs->write( $collection );
101114
@@ -102,7 +115,7 @@
103116 if ( $definitionFile ) {
104117 if ( is_file( $definitionFile ) ) {
105118 $targetFileName = $ffs->getWritePath() . $group->getTargetFilename( $collection->code );
106 - $cmd = "msgmerge --update --backup=off " . $targetFileName . ' ' . $definitionFile;
 119+ $cmd = "msgmerge --quiet --update --backup=off " . $targetFileName . ' ' . $definitionFile;
107120 wfShellExec( $cmd, $ret );
108121
109122 // Report on errors.

Follow-up revisions

RevisionCommit summaryAuthorDate
r73827Fix syntax error in r73826.siebrand21:38, 27 September 2010

Status & tagging log