r85318 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85317‎ | r85318 | r85319 >
Date:07:39, 4 April 2011
Author:siebrand
Status:deferred
Tags:
Comment:
stylize.php.
Modified paths:
  • /trunk/extensions/Translate/FFS.php (modified) (history)
  • /trunk/extensions/Translate/Groups.php (modified) (history)
  • /trunk/extensions/Translate/MessageChecks.php (modified) (history)
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslateEditAddons.php (modified) (history)
  • /trunk/extensions/Translate/TranslateTasks.php (modified) (history)
  • /trunk/extensions/Translate/TranslateUtils.php (modified) (history)
  • /trunk/extensions/Translate/ffs/Gettext.php (modified) (history)
  • /trunk/extensions/Translate/groups/MediaWiki/Checker.php (modified) (history)
  • /trunk/extensions/Translate/groups/MediaWikiExtensions.php (modified) (history)
  • /trunk/extensions/Translate/groups/Toolserver/ToolserverTextdomains.php (modified) (history)
  • /trunk/extensions/Translate/scripts/cldr-plural-to-yaml.php (modified) (history)
  • /trunk/extensions/Translate/scripts/export.php (modified) (history)
  • /trunk/extensions/Translate/scripts/list-mwext-i18n-files.php (modified) (history)
  • /trunk/extensions/Translate/scripts/logfilter.php (modified) (history)
  • /trunk/extensions/Translate/scripts/magic-export.php (modified) (history)
  • /trunk/extensions/Translate/scripts/plural-comparison.php (modified) (history)
  • /trunk/extensions/Translate/scripts/yaml-tests.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialLanguageStats.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialManageGroups.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialTranslationStats.php (modified) (history)
  • /trunk/extensions/Translate/tag/TranslatablePage.php (modified) (history)
  • /trunk/extensions/Translate/utils/CompatibilityCode.php (modified) (history)
  • /trunk/extensions/Translate/utils/MemoryCache.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageGroupCache.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageTable.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslateYaml.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslationEditPage.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslationHelpers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/scripts/list-mwext-i18n-files.php
@@ -18,7 +18,7 @@
1919 }
2020 require_once( "$IP/maintenance/Maintenance.php" );
2121
22 -/// Script which lists required i18n files for mediawiki extensions.
 22+/// Script which lists required i18n files for MediaWiki extensions.
2323 class MWExtFileList extends Maintenance {
2424 public function __construct() {
2525 parent::__construct();
@@ -34,9 +34,9 @@
3535 foreach ( $groups as $group ) {
3636 if ( !$group instanceof ExtensionMessageGroup ) continue;
3737 if ( $target && $group->getPath() !== $target ) continue;
38 - $this->addPaths( $group->getMessageFile('en') );
39 - $this->addPaths( $group->getAliasFile('en') );
40 - $this->addPaths( $group->getMagicFile('en') );
 38+ $this->addPaths( $group->getMessageFile( 'en' ) );
 39+ $this->addPaths( $group->getAliasFile( 'en' ) );
 40+ $this->addPaths( $group->getMagicFile( 'en' ) );
4141 }
4242
4343 $files = array_keys( $this->files );
Index: trunk/extensions/Translate/scripts/magic-export.php
@@ -122,7 +122,7 @@
123123 // Seek first '*/'.
124124 $end = strpos( $data, '*/' ) + 2;
125125
126 - if( $end === false ) {
 126+ if ( $end === false ) {
127127 die( "No header found in '$file'.\n" );
128128 }
129129
@@ -262,8 +262,8 @@
263263 */
264264 protected function writeFooters() {
265265 $this->output( "Writing file footers...\n" );
266 - if( $this->type === 'special' ) {
267 - foreach( $this->handles as $handle ) {
 266+ if ( $this->type === 'special' ) {
 267+ foreach ( $this->handles as $handle ) {
268268 fwrite( $handle, <<<PHP
269269
270270
Index: trunk/extensions/Translate/scripts/cldr-plural-to-yaml.php
@@ -35,7 +35,7 @@
3636 $doc->load( 'plurals.xml' );
3737
3838 $rulesets = $doc->getElementsByTagName( "pluralRules" );
39 - foreach( $rulesets as $ruleset ) {
 39+ foreach ( $rulesets as $ruleset ) {
4040 $codes = $ruleset->getAttribute( 'locales' );
4141 $parsed = array();
4242 $rules = $ruleset->getElementsByTagName( "pluralRule" );
@@ -50,13 +50,13 @@
5151 $name = "Zero";
5252 } elseif ( $codes === 'ar' ) {
5353 $name = "Arabic";
54 - } elseif( count( $parsed ) === 1 ) {
 54+ } elseif ( count( $parsed ) === 1 ) {
5555 if ( isset( $parsed['one'] ) && $parsed['one'] === 'n is 1' ) {
5656 $name = "Default";
57 - } elseif( isset( $parsed['one'] ) && $parsed['one'] === 'n in 0..1' ) {
 57+ } elseif ( isset( $parsed['one'] ) && $parsed['one'] === 'n in 0..1' ) {
5858 $name = "One-zero";
5959 }
60 - } elseif( count( $parsed ) === 2 ) {
 60+ } elseif ( count( $parsed ) === 2 ) {
6161 if ( isset( $parsed['one'] ) && isset( $parsed['two'] ) ) {
6262 $name = "Has-dual";
6363 }
Index: trunk/extensions/Translate/scripts/yaml-tests.php
@@ -79,11 +79,11 @@
8080 return $groups;
8181 }
8282
83 - public static function sortNestedArrayAssoc(&$a) {
84 - ksort($a);
85 - foreach ($a as $key => &$value) {
86 - if (is_array($value)) {
87 - self::sortNestedArrayAssoc($value);
 83+ public static function sortNestedArrayAssoc( &$a ) {
 84+ ksort( $a );
 85+ foreach ( $a as $key => &$value ) {
 86+ if ( is_array( $value ) ) {
 87+ self::sortNestedArrayAssoc( $value );
8888 }
8989 }
9090 }
Index: trunk/extensions/Translate/scripts/plural-comparison.php
@@ -33,7 +33,7 @@
3434 sort( $allkeys );
3535
3636 $this->output( sprintf( "%12s %3s %3s %4s\n", 'Code', 'MW', 'Get', 'CLDR' ) );
37 - foreach( $allkeys as $index => $code ) {
 37+ foreach ( $allkeys as $index => $code ) {
3838 $mw = isset( $mwLanguages[$code] ) ? ( $mwLanguages[$code] === false ? '.' : '+' ) : '';
3939 $gt = isset( $gtLanguages[$code] ) ? ( $gtLanguages[$code] === '(n != 1);' ? '.' : '+' ) : '';
4040 $cl = isset( $clLanguages[$code] ) ? ( $clLanguages[$code][0] === 'Default' ? '.' : '+' ) : '';
@@ -72,7 +72,7 @@
7373 $cldrmap = array();
7474 $error = false;
7575
76 - for( $i = 0; $i <= 200; $i++ ) {
 76+ for ( $i = 0; $i <= 200; $i++ ) {
7777 $mw = $obj ? $obj->convertPlural( $i, array( 0, 1, 2, 3, 4, 5 ) ) : '?';
7878 $gt = $gtExp ? eval( $gtExp ) : '?';
7979 $cldr = $cldrExp !== false ? $this->evalCLDRRule( $i, $cldrExp ) : '?';
@@ -116,7 +116,7 @@
117117 $ruleExps = array();
118118 foreach ( $data['rulesets'] as $name => $rules ) {
119119 $ruleExps[$name] = array();
120 - foreach( $rules as $rulename => $rule ) {
 120+ foreach ( $rules as $rulename => $rule ) {
121121 $ruleExps[$name][$rulename] = $this->parseCLDRRule( $rule );
122122 }
123123 }
@@ -172,11 +172,11 @@
173173 $rule = preg_replace( '/([^ ]+) within (\d+)\.\.(\d+)/', 'self::within(\1,\2,\3)', $rule );
174174 // AND takes precedence over OR
175175 $andrule = '/([^ ]+) and ([^ ]+)/i';
176 - while( preg_match( $andrule, $rule ) ) {
 176+ while ( preg_match( $andrule, $rule ) ) {
177177 $rule = preg_replace( $andrule, '(\1&&\2)', $rule );
178178 }
179179 $orrule = '/([^ ]+) or ([^ ]+)/i';
180 - while( preg_match( $orrule, $rule ) ) {
 180+ while ( preg_match( $orrule, $rule ) ) {
181181 $rule = preg_replace( $orrule, '(\1||\2)', $rule );
182182 }
183183
Index: trunk/extensions/Translate/scripts/export.php
@@ -83,9 +83,9 @@
8484
8585 $groups = array();
8686
87 -if( isset( $options['group'] ) ) {
 87+if ( isset( $options['group'] ) ) {
8888 $groups[$options['group']] = MessageGroups::getGroup( $options['group'] );
89 -} elseif( isset( $options['groups'] ) ) {
 89+} elseif ( isset( $options['groups'] ) ) {
9090 // Explode parameter
9191 $groupIds = explode( ',', trim( $options['groups'] ) );
9292
@@ -98,14 +98,14 @@
9999 $allGroups = MessageGroups::singleton()->getGroups();
100100
101101 // Add matching groups to groups array.
102 - foreach( $allGroups as $groupId => $messageGroup ) {
103 - if( strpos( $groupId, $options['grouptrail'] ) === 0 && !$messageGroup->isMeta() ) {
 102+ foreach ( $allGroups as $groupId => $messageGroup ) {
 103+ if ( strpos( $groupId, $options['grouptrail'] ) === 0 && !$messageGroup->isMeta() ) {
104104 $groups[$groupId] = $messageGroup;
105105 }
106106 }
107107 }
108108
109 -foreach( $groups as $groupId => $group ) {
 109+foreach ( $groups as $groupId => $group ) {
110110 if ( !$group instanceof MessageGroup ) {
111111 STDERR( "Invalid group: " . $groupId );
112112 exit( 1 );
@@ -143,7 +143,7 @@
144144
145145 foreach ( $langs as $lang ) {
146146 // Do not export if language code is to be skipped or is not a valid language.
147 - if( in_array( $lang, $skip ) || !$group->isValidLanguage( $lang ) ) {
 147+ if ( in_array( $lang, $skip ) || !$group->isValidLanguage( $lang ) ) {
148148 continue;
149149 }
150150
Index: trunk/extensions/Translate/scripts/logfilter.php
@@ -37,7 +37,7 @@
3838 if ( mb_strlen( $line ) > 400 ) {
3939 $line = mb_substr( $line, 0, 400 ) . '...';
4040 }
41 - echo trim( $prefix.$line ) . "\n";
 41+ echo trim( $prefix . $line ) . "\n";
4242 }
4343
4444 sleep( 30 );
Index: trunk/extensions/Translate/MessageChecks.php
@@ -376,8 +376,8 @@
377377
378378 libxml_use_internal_errors( true );
379379 libxml_clear_errors();
380 - $doc = simplexml_load_string( Xml::tags( 'root', null, $translation ));
381 - if ($doc) continue;
 380+ $doc = simplexml_load_string( Xml::tags( 'root', null, $translation ) );
 381+ if ( $doc ) continue;
382382
383383 $errors = libxml_get_errors();
384384 $params = array();
Index: trunk/extensions/Translate/FFS.php
@@ -725,7 +725,7 @@
726726
727727 $messages = $this->flatten( $messages );
728728 $messages = $this->group->getMangler()->mangle( $messages );
729 - foreach( $messages as $key => &$value ) {
 729+ foreach ( $messages as $key => &$value ) {
730730 $value = rtrim( $value, "\n" );
731731 }
732732
@@ -1065,18 +1065,18 @@
10661066
10671067 public function read( $code ) {
10681068 // TODO: Improve this code to not use static variables.
1069 - if( !isset( self::$data[$this->group->getId()] ) ) {
 1069+ if ( !isset( self::$data[$this->group->getId()] ) ) {
10701070 $filename = $this->group->getSourceFilePath( $code );
10711071 $json = shell_exec( "python -c'import simplejson as json; execfile(\"$filename\"); print json.dumps(msg)'" );
10721072 self::$data[$this->group->getId()] = json_decode( $json, true );
10731073 }
1074 - if( !isset( self::$data[$this->group->getId()][$code] ) ) self::$data[$this->group->getId()][$code] = array();
 1074+ if ( !isset( self::$data[$this->group->getId()][$code] ) ) self::$data[$this->group->getId()][$code] = array();
10751075 return array( 'MESSAGES' => self::$data[$this->group->getId()][$code] );
10761076 }
10771077
10781078
10791079 public function write( MessageCollection $collection ) {
1080 - if( $this->fw === null ) {
 1080+ if ( $this->fw === null ) {
10811081 $outputFile = $this->writePath . '/' . $this->group->getTargetFilename( 'en' );
10821082 wfMkdirParents( dirname( $outputFile ), null, __METHOD__ );
10831083 $this->fw = fopen( $outputFile, 'w' );
@@ -1087,13 +1087,13 @@
10881088 // Not sure why this is needed, only continue if there are translations.
10891089 $collection->loadTranslations();
10901090 $ok = false;
1091 - foreach( $collection as $messages ) {
1092 - if( $messages->translation() != '' ) $ok = true;
 1091+ foreach ( $collection as $messages ) {
 1092+ if ( $messages->translation() != '' ) $ok = true;
10931093 }
1094 - if( !$ok ) return;
 1094+ if ( !$ok ) return;
10951095
1096 - $authors = $this->doAuthors($collection);
1097 - if( $authors != '' ) fwrite( $this->fw, "$authors" );
 1096+ $authors = $this->doAuthors( $collection );
 1097+ if ( $authors != '' ) fwrite( $this->fw, "$authors" );
10981098 fwrite( $this->fw, "\t'{$collection->code}': {\n" );
10991099 fwrite( $this->fw, $this->writeBlock( $collection ) );
11001100 fwrite( $this->fw, "\t},\n" );
@@ -1112,15 +1112,15 @@
11131113 protected function writeBlock( MessageCollection $collection ) {
11141114 $block = '';
11151115 $messages = array();
1116 - foreach( $collection as $message ) {
1117 - if( $message->translation() == '' ) continue;
 1116+ foreach ( $collection as $message ) {
 1117+ if ( $message->translation() == '' ) continue;
11181118 $translation = str_replace( '\\', '\\\\', $message->translation() );
11191119 $translation = str_replace( '\'', '\\\'', $translation );
11201120 $translation = str_replace( "\n", '\n', $translation );
11211121 $messages[$message->key()] = $translation;
11221122 }
11231123 ksort( $messages );
1124 - foreach( $messages as $key => $translation ) {
 1124+ foreach ( $messages as $key => $translation ) {
11251125 $block .= "\t\t'{$key}': u'{$translation}',\n";
11261126 }
11271127 return $block;
@@ -1132,11 +1132,11 @@
11331133 // Read authors.
11341134 $fr = fopen( $this->group->getSourceFilePath( $collection->code ), 'r' );
11351135 $authors = array();
1136 - while( !feof( $fr ) ) {
 1136+ while ( !feof( $fr ) ) {
11371137 $line = fgets( $fr );
1138 - if( strpos( $line, "\t# Author:" ) === 0 ) {
 1138+ if ( strpos( $line, "\t# Author:" ) === 0 ) {
11391139 $authors[] = trim( substr( $line, strlen( "\t# Author: " ) ) );
1140 - } elseif( $line === "\t'{$collection->code}': {\n" ) {
 1140+ } elseif ( $line === "\t'{$collection->code}': {\n" ) {
11411141 break;
11421142 } else {
11431143 $authors = array();
@@ -1154,7 +1154,7 @@
11551155 }
11561156
11571157 public function __destruct() {
1158 - if( $this->fw !== null ) {
 1158+ if ( $this->fw !== null ) {
11591159 fwrite( $this->fw, "}" );
11601160 fclose( $this->fw );
11611161 }
Index: trunk/extensions/Translate/MessageGroups.php
@@ -732,7 +732,7 @@
733733 $tables = 'translate_sections';
734734 $vars = array( 'trs_key', 'trs_text' );
735735 $conds = array( 'trs_page' => $this->getTitle()->getArticleId() );
736 - $options = array( 'ORDER BY' => 'trs_order');
 736+ $options = array( 'ORDER BY' => 'trs_order' );
737737 $res = $dbr->select( $tables, $vars, $conds, __METHOD__, $options );
738738
739739 $defs = array();
@@ -1082,4 +1082,4 @@
10831083
10841084 }
10851085
1086 -class SingleFileBasedMessageGroup extends FileBasedMessageGroup{}
 1086+class SingleFileBasedMessageGroup extends FileBasedMessageGroup {}
Index: trunk/extensions/Translate/tag/TranslatablePage.php
@@ -738,7 +738,7 @@
739739 $options = array( 'GROUP BY' => 'rt_page' );
740740
741741 $res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options );
742 - $results = array();
 742+ $results = array();
743743 foreach ( $res as $row ) {
744744 $results[] = $row->rt_page;
745745 }
Index: trunk/extensions/Translate/groups/MediaWiki/Checker.php
@@ -292,7 +292,7 @@
293293 */
294294 protected static function getPrefMessages() {
295295 // @todo: moar?
296 - return array(
 296+ return array(
297297 array(
298298 'Mw_math_png',
299299 'Mw_math_simple',
Index: trunk/extensions/Translate/groups/Toolserver/ToolserverTextdomains.php
@@ -82,7 +82,7 @@
8383
8484 // All messages are prefixed with their groupname
8585 $g['mangle'] = array( '*' );
86 -
 86+
8787 // Prevent E_NOTICE undefined index.
8888 // PremadeMediawikiExtensionGroups::factory should probably check this better instead
8989 if ( !isset( $g['ignored'] ) ) $g['ignored'] = array();
Index: trunk/extensions/Translate/groups/MediaWikiExtensions.php
@@ -211,7 +211,7 @@
212212 $postfix = 'Configure/load_txt_def/TxtDef.php';
213213 if ( file_exists( "$IP/extensions/$postfix" ) ) {
214214 $prefix = "$IP/extensions";
215 - } elseif( file_exists( "$wgTranslateExtensionDirectory/$postfix" ) ) {
 215+ } elseif ( file_exists( "$wgTranslateExtensionDirectory/$postfix" ) ) {
216216 $prefix = $wgTranslateExtensionDirectory;
217217 } else {
218218 $prefix = false;
Index: trunk/extensions/Translate/TranslateEditAddons.php
@@ -54,11 +54,11 @@
5555 }
5656 }
5757
58 - if ( isset( $keys[$index-1] ) ) {
59 - $prev = $keys[$index-1];
 58+ if ( isset( $keys[$index -1] ) ) {
 59+ $prev = $keys[$index -1];
6060 }
61 - if ( isset( $keys[$index+1] ) ) {
62 - $next = $keys[$index+1];
 61+ if ( isset( $keys[$index + 1] ) ) {
 62+ $next = $keys[$index + 1];
6363 }
6464
6565 $id = $group->getId();
@@ -449,7 +449,7 @@
450450 public static function disablePreSaveTransform( $article, $popts ) {
451451 global $wgTranslateDocumentationLanguageCode;
452452 $keycodegroup = self::getKeyCodeGroup( $article->getTitle() );
453 - if( self::isMessageNamespace( $article->getTitle() )
 453+ if ( self::isMessageNamespace( $article->getTitle() )
454454 && $keycodegroup[1] !== $wgTranslateDocumentationLanguageCode ) {
455455 $popts->setPreSaveTransform( false );
456456 }
@@ -471,7 +471,7 @@
472472 $th->setEditMode( false );
473473 $th->setTranslation( $de->mNewtext );
474474 TranslateUtils::injectCSS();
475 -
 475+
476476 $boxes = array();
477477 $boxes[] = $th->getDocumentationBox();
478478 $boxes[] = $th->getDefinitionBox();
Index: trunk/extensions/Translate/Translate.php
@@ -117,9 +117,9 @@
118118 $wgAvailableRights[] = 'translate-manage';
119119
120120 // Client-side resource modules
121 -$wgResourceModules['translate-css'] = array(
 121+$wgResourceModules['translate-css'] = array(
122122 'styles' => 'Translate.css',
123 - 'localBasePath' => dirname( __FILE__ ),
 123+ 'localBasePath' => dirname( __FILE__ ),
124124 'remoteExtPath' => 'Translate'
125125 );
126126 $wgResourceModules['ext.translate.langstats'] = array(
@@ -169,7 +169,7 @@
170170 * Text that will be shown in translations if the translation is outdated.
171171 * Must be something that does not conflict with actual content.
172172 */
173 -if( !defined( 'TRANSLATE_FUZZY' ) ) {
 173+if ( !defined( 'TRANSLATE_FUZZY' ) ) {
174174 define( 'TRANSLATE_FUZZY', '!!FUZZY!!' );
175175 }
176176
Index: trunk/extensions/Translate/TranslateTasks.php
@@ -417,7 +417,7 @@
418418 if ( $this->group instanceof FileBasedMessageGroup ) {
419419 $ffs = $this->group->getFFS();
420420 }
421 -
 421+
422422 if ( !$ffs instanceof GettextFFS ) {
423423 $group = FileBasedMessageGroup::newFromMessageGroup( $this->group );
424424 $ffs = new GettextFFS( $group );
Index: trunk/extensions/Translate/utils/MemoryCache.php
@@ -43,7 +43,7 @@
4444 }
4545
4646 /**
47 - * @copydoc ArrayMemoryCache::__construct()
 47+ * @copydoc ArrayMemoryCache::__construct()
4848 * Static factory function for the constructor.
4949 */
5050 public static function factory( $table ) {
Index: trunk/extensions/Translate/utils/MessageTable.php
@@ -123,7 +123,7 @@
124124 $tableheader .= Xml::closeElement( 'tr' );
125125 }
126126
127 - return $tableheader ."\n";
 127+ return $tableheader . "\n";
128128 }
129129
130130 public function contents() {
@@ -135,7 +135,7 @@
136136
137137 $mlang = Language::factory( $this->code );
138138 $mespa = array( 'dir' => $mlang->getDir(), 'lang' => $this->code );
139 - unset($mlang);
 139+ unset( $mlang );
140140
141141 $batch = new LinkBatch();
142142 if ( method_exists( $batch, 'setCaller' ) ) {
@@ -157,7 +157,7 @@
158158 $title = $this->keyToTitle( $key );
159159
160160 $original = $m->definition();
161 - #TODO: handle directionality of fallback language(s)
 161+ # @todo Handle directionality of fallback language(s)
162162 if ( $m->translation() ) {
163163 $message = $m->translation();
164164 $rclasses = array_merge ( $mespa, array( 'class' => 'translated' ) );
Index: trunk/extensions/Translate/utils/TranslationEditPage.php
@@ -199,7 +199,7 @@
200200
201201 $support = Html::element(
202202 'input',
203 - array(
 203+ array(
204204 'class' => 'mw-translate-support',
205205 'type' => 'button',
206206 'value' => wfMsg( 'translate-js-support' ),
Index: trunk/extensions/Translate/utils/CompatibilityCode.php
@@ -14,8 +14,8 @@
1515 class TranslateBC {
1616
1717 /**
18 - * Create a call to a JavaScript function. The supplied arguments will be
19 - * encoded using Xml::encodeJsVar().
 18+ * Create a call to a JavaScript function. The supplied arguments will be
 19+ * encoded using Xml::encodeJsVar().
2020 *
2121 * @param $name The name of the function to call, or a JavaScript expression
2222 * which evaluates to a function object which is called.
Index: trunk/extensions/Translate/utils/TranslateYaml.php
@@ -89,7 +89,7 @@
9090 if ( is_array( $value ) ) {
9191 self::fixSpycSpaces( $value );
9292 } elseif ( is_string( $value ) && $key === 'header' ) {
93 - $value = preg_replace( '~^\*~m', ' *', $value ). "\n";
 93+ $value = preg_replace( '~^\*~m', ' *', $value ) . "\n";
9494 }
9595 }
9696 return $yaml;
Index: trunk/extensions/Translate/utils/TranslationHelpers.php
@@ -204,7 +204,7 @@
205205 $all['translation-memory'] = array( $this, 'getLazySuggestionBox' );
206206 } elseif ( $suggestions === 'only' ) {
207207 return (string) call_user_func( $all['translation-memory'], 'lazy' );
208 - } elseif( $suggestions === 'checks' ) {
 208+ } elseif ( $suggestions === 'checks' ) {
209209 global $wgRequest;
210210 $this->translation = $wgRequest->getText( 'translation' );
211211 return (string) call_user_func( $all['check'] );
@@ -457,7 +457,7 @@
458458 $options = array();
459459 $options['timeout'] = $config['timeout'];
460460
461 - $params = array(
 461+ $params = array(
462462 'text' => $definition,
463463 'to' => $code,
464464 );
@@ -498,7 +498,7 @@
499499 self::reportTranslationServiceFailure( $serviceName );
500500 return null;
501501 }
502 -
 502+
503503 $ret = $req->getContent();
504504 $text = preg_replace( '~<string.*>(.*)</string>~', '\\1', $ret );
505505 $text = Sanitizer::decodeCharReferences( $text );
Index: trunk/extensions/Translate/utils/MessageGroupCache.php
@@ -11,7 +11,7 @@
1212 * Caches messages of file based message group source file. Can also track
1313 * that the cache is up to date. Parsing the source files can be slow, so
1414 * constructing CDB cache makes accessing that data constant speed regardless
15 - * of the actual format.
 15+ * of the actual format.
1616 */
1717 class MessageGroupCache {
1818 /// \string
@@ -112,7 +112,7 @@
113113 $group = $this->group;
114114 $groupId = $group->getId();
115115
116 - if( $group instanceof SingleFileBasedMessageGroup ) {
 116+ if ( $group instanceof SingleFileBasedMessageGroup ) {
117117 $messages = $group->load( $this->code );
118118
119119 $cache = $this->exists();
@@ -228,7 +228,7 @@
229229 '#version' => '3',
230230 );
231231 $conv['#msgcount'] = count( $conv['#keys'] );
232 -
 232+
233233 $messages = array();
234234 foreach ( unserialize( $conv['#keys'] ) as $key ) {
235235 $messages[$key] = $oldcache->get( $key );
Index: trunk/extensions/Translate/specials/SpecialManageGroups.php
@@ -337,7 +337,7 @@
338338 if ( $this->user->isAllowed( 'translate-manage' ) ) {
339339 $this->out->addHTML( Xml::submitButton( wfMsg( 'translate-manage-submit' ) ) );
340340 }
341 - } elseif( $this->user->isAllowed( 'translate-manage' ) ) {
 341+ } elseif ( $this->user->isAllowed( 'translate-manage' ) ) {
342342 $cache->create(); // Update timestamp
343343 $this->out->addWikiMsg( 'translate-manage-nochanges' );
344344 }
Index: trunk/extensions/Translate/specials/SpecialTranslationStats.php
@@ -442,9 +442,9 @@
443443 $group = MessageGroups::getGroup( $groupId );
444444 $group = $group ? $group->getLabel() : $groupId;
445445 $label = "$group @ $code";
446 - } elseif( $code ) {
 446+ } elseif ( $code ) {
447447 $label = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() ) . " ($code)";
448 - } elseif( $groupId ) {
 448+ } elseif ( $groupId ) {
449449 $group = MessageGroups::getGroup( $groupId );
450450 $label = $group ? $group->getLabel() : $groupId;
451451 }
@@ -545,7 +545,7 @@
546546 * - roundToSignificant( 1234, 1 ) = 2000
547547 * - roundToSignificant( 1234, 2 ) = 1300
548548 * - roundToSignificant( 1234, 3 ) = 1240
549 - *
 549+ *
550550 * @param $number \int Number to round.
551551 * @param $significant \int How many signficant numbers to keep.
552552 * @return \int Rounded number.
Index: trunk/extensions/Translate/specials/SpecialLanguageStats.php
@@ -218,7 +218,7 @@
219219 $cache->commit();
220220
221221 if ( $out ) {
222 - $out = $this->createHeader( $code ) ."\n" . $out;
 222+ $out = $this->createHeader( $code ) . "\n" . $out;
223223 $out .= Xml::closeElement( 'table' );
224224 } else {
225225 $out = wfMsgExt( 'translate-nothing-to-do', 'parse' );
@@ -236,7 +236,7 @@
237237 $top = array_shift( $item );
238238 $out .= $this->makeGroupRow( $top, $cache, $parent === '' ? true : $parent );
239239 foreach ( $item as $subgroup ) {
240 - $parents = trim( $parent . ' ' .$top->getId() );
 240+ $parents = trim( $parent . ' ' . $top->getId() );
241241 $out .= $this->makeGroupGroup( $subgroup, $cache, $parents );
242242 }
243243 return $out;
@@ -292,7 +292,7 @@
293293 $rowParams['data-groupid'] = $groupId;
294294 if ( is_string( $parent ) ) {
295295 $rowParams['data-parentgroups'] = $parent;
296 - } elseif( $parent === true ) {
 296+ } elseif ( $parent === true ) {
297297 $rowParams['data-ismeta'] = '1';
298298 }
299299
@@ -307,15 +307,15 @@
308308 array( 'data-sort-value' => $total - $translated ),
309309 $wgLang->formatNum( $total - $translated ) );
310310
311 - $out .= "\n\t\t" .$this->element( $this->formatPercentage( $translated / $total ),
 311+ $out .= "\n\t\t" . $this->element( $this->formatPercentage( $translated / $total ),
312312 $this->getBackgroundColour( $translated, $total ),
313313 sprintf( '%1.3f', $translated / $total ) );
314314
315 - $out .= "\n\t\t" .$this->element( $this->formatPercentage( $fuzzy / $total ),
 315+ $out .= "\n\t\t" . $this->element( $this->formatPercentage( $fuzzy / $total ),
316316 $this->getBackgroundColour( $fuzzy, $total, true ),
317317 sprintf( '%1.3f', $fuzzy / $total ) );
318318
319 - $out .= "\n\t" . Xml::closeElement( 'tr' ) ."\n";
 319+ $out .= "\n\t" . Xml::closeElement( 'tr' ) . "\n";
320320 return $out;
321321 }
322322
@@ -333,7 +333,7 @@
334334 // Initialise messages.
335335 $collection = $group->initCollection( $code );
336336 // Takes too much memory and only hides inconsistent import state
337 - #$collection->setInFile( $group->load( $code ) );
 337+ # $collection->setInFile( $group->load( $code ) );
338338 $collection->filter( 'ignored' );
339339 $collection->filter( 'optional' );
340340 // Store the count of real messages for later calculation.
Index: trunk/extensions/Translate/TranslateUtils.php
@@ -416,7 +416,7 @@
417417 private $selected = false;
418418 /// \array Extra html attributes.
419419 private $attributes = array();
420 -
 420+
421421 /**
422422 * @param $name \string
423423 * @param $id \string Default false.
Index: trunk/extensions/Translate/Groups.php
@@ -582,7 +582,7 @@
583583 protected function expandWildcards( $ids ) {
584584 $hasWild = false;
585585 foreach ( $ids as $id ) {
586 - if ( strpos( $id, '*' ) !== false ) {
 586+ if ( strpos( $id, '*' ) !== false ) {
587587 $hasWild = true;
588588 break;
589589 }
Index: trunk/extensions/Translate/ffs/Gettext.php
@@ -182,7 +182,7 @@
183183 }
184184 }
185185 $item['flags'] = $flags;
186 -
 186+
187187 // Rest of the comments
188188 $matches = array();
189189 if ( preg_match_all( '/^#(.?) (.*)$/m', $section, $matches, PREG_SET_ORDER ) ) {
@@ -287,7 +287,7 @@
288288 error_log( __METHOD__ . ": $line" );
289289 }
290290 list( $key, $value ) = explode( ':', $line, 2 );
291 - $tags[trim($key)] = trim($value);
 291+ $tags[trim( $key )] = trim( $value );
292292 }
293293
294294 return $tags;
@@ -304,7 +304,7 @@
305305 $template['TEMPLATE'][$key] : array();
306306 $potTemplate = isset( $pot['TEMPLATE'][$key] ) ?
307307 $pot['TEMPLATE'][$key] : array();
308 -
 308+
309309 $output .= $this->formatMessageBlock( $key, $m, $transTemplate, $potTemplate, $pluralCount );
310310 }
311311
@@ -333,7 +333,7 @@
334334 // Make sure there is no empty line before msgid
335335 $output = trim( $output ) . "\n";
336336
337 - /// @todo twn specific
 337+ // @todo twn specific
338338 $portal = Title::makeTitle( NS_PORTAL, $code )->getFullUrl();
339339
340340 $specs = isset( $template['HEADERS'] ) ? $template['HEADERS'] : array();
@@ -361,7 +361,7 @@
362362 $plural = self::getPluralRule( $code );
363363 if ( $plural ) {
364364 $specs['Plural-Forms'] = $plural;
365 - } elseif( !isset( $specs['Plural-Forms'] ) ) {
 365+ } elseif ( !isset( $specs['Plural-Forms'] ) ) {
366366 $specs['Plural-Forms'] = 'nplurals=2; plural=(n != 1);';
367367 }
368368

Status & tagging log