r28723 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28722‎ | r28723 | r28724 >
Date:19:31, 20 December 2007
Author:hashar
Status:old
Tags:
Comment:
* fix --lang parameter
* fix message array iteration (it needed the 'all' key)
Modified paths:
  • /trunk/phase3/maintenance/language/lang2po.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/lang2po.php
@@ -7,6 +7,8 @@
88 * - fix escaping of \
99 */
1010
 11+$optionsWithArgs[] = 'lang';
 12+
1113 /** This is a command line script */
1214 require_once(dirname(__FILE__).'/../commandLine.inc');
1315 require_once(dirname(__FILE__).'/languages.inc');
@@ -73,7 +75,7 @@
7476 $data = poHeader();
7577
7678 // Generate .po entries
77 - foreach($messages as $identifier => $content) {
 79+ foreach($messages['all'] as $identifier => $content) {
7880 $data .= "msgid \"$identifier\"\n";
7981
8082 // Escape backslashes
@@ -134,8 +136,14 @@
135137
136138 $langTool = new languages();
137139
 140+if( $options['lang'] === ALL_LANGUAGES ) {
 141+ $codes = $langTool->getLanguages();
 142+} else {
 143+ $codes = array( $options['lang'] );
 144+}
 145+
138146 // Do all languages
139 -foreach ( $langTool->getLanguages() as $langcode) {
 147+foreach ( $codes as $langcode) {
140148 echo "Loading messages for $langcode:\n";
141149 if( ! generatePo($langcode, $langTool->getMessages($langcode) ) ) {
142150 echo "ERROR: Failed to write file.\n";

Status & tagging log