r94015 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94014‎ | r94015 | r94016 >
Date:08:43, 6 August 2011
Author:siebrand
Status:ok
Tags:
Comment:
Fix spelling, grammar and punctuation in exception texts.
Modified paths:
  • /trunk/extensions/Translate/FFS.php (modified) (history)
  • /trunk/extensions/Translate/Groups.php (modified) (history)
  • /trunk/extensions/Translate/scripts/mwcore-export.php (modified) (history)
  • /trunk/extensions/Translate/tag/SpecialPageTranslation.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/scripts/mwcore-export.php
@@ -33,22 +33,22 @@
3434 }
3535
3636 if ( !isset( $options['target'] ) ) {
37 - STDERR( "You need to specify target directory" );
 37+ STDERR( "You need to specify target directory." );
3838 exit( 1 );
3939 }
4040
4141 if ( !isset( $options['lang'] ) ) {
42 - STDERR( "You need to specify languages to export" );
 42+ STDERR( "You need to specify languages to export." );
4343 exit( 1 );
4444 }
4545
4646 if ( !isset( $options['type'] ) ) {
47 - STDERR( "Type must be one of the following: special magic namespace" );
 47+ STDERR( "Type must be one of the following: special magic namespace." );
4848 exit( 1 );
4949 }
5050
5151 if ( !is_writable( $options['target'] ) ) {
52 - STDERR( "Target directory is not writable" );
 52+ STDERR( "Target directory is not writable." );
5353 exit( 1 );
5454 }
5555
@@ -70,7 +70,7 @@
7171 $o = new NamespaceCM( $l );
7272 break;
7373 default:
74 - STDERR( "Invalid type: must be one of special, magic, namespace" );
 74+ STDERR( "Invalid type: must be one of special, magic, namespace." );
7575 exit( 1 );
7676 }
7777
@@ -90,7 +90,7 @@
9191 $export = preg_replace( "~^# .*$\n~m", '', $export );
9292
9393 if ( strpos( $export, '#!!' ) !== false ) {
94 - STDERR( "There is warnings with $l" );
 94+ STDERR( "There are warnings with $l." );
9595 }
9696
9797 $variable = preg_quote( $matches[1], '~' );
@@ -98,7 +98,7 @@
9999 $file = $group->getMessageFileWithPath( $l );
100100
101101 if ( !file_exists( $file ) ) {
102 - STDERR( "File $file does not exists!" );
 102+ STDERR( "File $file does not exist!" );
103103 continue;
104104 }
105105
@@ -114,7 +114,7 @@
115115 if ( $count ) {
116116 file_put_contents( $outFile, $data );
117117 } else {
118 - STDERR( "Adding new entry to $outFile, please double check location", $l );
 118+ STDERR( "Adding new entry to $outFile, please double check location.", $l );
119119 $pos = strpos( $data, "*/" );
120120 if ( $pos === false ) {
121121 STDERR( ". FAILED! Totally new file? No header?", $l );
Index: trunk/extensions/Translate/FFS.php
@@ -114,7 +114,7 @@
115115 $filename = $this->group->getSourceFilePath( $code );
116116 $input = file_get_contents( $filename );
117117 if ( $input === false ) {
118 - throw new MWException( "Unable to read file $filename" );
 118+ throw new MWException( "Unable to read file $filename." );
119119 }
120120
121121 return $this->readFromVariable( $input );
@@ -124,7 +124,7 @@
125125 $parts = explode( "\0\0\0\0", $data );
126126
127127 if ( count( $parts ) !== 2 ) {
128 - throw new MWException( 'Wrong number of parts' );
 128+ throw new MWException( 'Wrong number of parts.' );
129129 }
130130
131131 list( $authorsPart, $messagesPart ) = $parts;
@@ -139,7 +139,7 @@
140140 $lineParts = explode( '=', $line, 2 );
141141
142142 if ( count( $lineParts ) !== 2 ) {
143 - throw new MWException( "Wrong number of parts in line $line" );
 143+ throw new MWException( "Wrong number of parts in line $line." );
144144 }
145145
146146 list( $key, $message ) = $lineParts;
@@ -159,15 +159,15 @@
160160 $writePath = $this->writePath;
161161
162162 if ( $writePath === null ) {
163 - throw new MWException( "Write path is not set" );
 163+ throw new MWException( "Write path is not set." );
164164 }
165165
166166 if ( !file_exists( $writePath ) ) {
167 - throw new MWException( "Write path '$writePath' does not exists" );
 167+ throw new MWException( "Write path '$writePath' does not exist." );
168168 }
169169
170170 if ( !is_writable( $writePath ) ) {
171 - throw new MWException( "Write path '$writePath' is not writable" );
 171+ throw new MWException( "Write path '$writePath' is not writable." );
172172 }
173173
174174 $targetFile = $writePath . '/' . $this->group->getTargetFilename( $collection->code );
@@ -234,12 +234,12 @@
235235 }
236236
237237 if ( !is_readable( $filename ) ) {
238 - throw new MWException( "File $filename is not readable" );
 238+ throw new MWException( "File $filename is not readable." );
239239 }
240240
241241 $data = file_get_contents( $filename );
242242 if ( $data == false ) {
243 - throw new MWException( "Unable to read file $filename" );
 243+ throw new MWException( "Unable to read file $filename." );
244244 }
245245
246246 return $data;
@@ -333,14 +333,14 @@
334334 }
335335
336336 if ( strpos( $line, $this->keySeparator ) === false ) {
337 - throw new MWException( "Line without '{$this->keySeparator}': $line" );
 337+ throw new MWException( "Line without '{$this->keySeparator}': $line." );
338338 }
339339
340340 list( $key, $value ) = explode( $this->keySeparator, $line, 2 );
341341 $key = trim( $key );
342342
343343 if ( $key === '' ) {
344 - throw new MWException( "Empty key in line $line" );
 344+ throw new MWException( "Empty key in line $line." );
345345 }
346346
347347 $value = str_replace( '\n', "\n", $value );
@@ -940,7 +940,7 @@
941941 if ( isset( self::$pluralWords[$key] ) ) {
942942 $plurals = true;
943943 } elseif ( $plurals ) {
944 - throw new MWException( "Reserved plural keywords mixed with other keys: $key" );
 944+ throw new MWException( "Reserved plural keywords mixed with other keys: $key." );
945945 }
946946 }
947947
Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php
@@ -508,7 +508,7 @@
509509
510510 $dbw = wfGetDB( DB_MASTER );
511511 if ( !$dbw->fieldExists( 'translate_sections', 'trs_order', __METHOD__ ) ) {
512 - error_log( 'Field trs_order does not exists. Please run update.php.' );
 512+ error_log( 'Field trs_order does not exist. Please run update.php.' );
513513 foreach ( array_keys( $inserts ) as $index ) {
514514 unset( $inserts[$index]['trs_order'] );
515515 }
Index: trunk/extensions/Translate/Groups.php
@@ -160,7 +160,7 @@
161161 }
162162
163163 if ( !class_exists( $class ) ) {
164 - throw new MWException( "FFS class $class does not exists" );
 164+ throw new MWException( "FFS class $class does not exist." );
165165 }
166166
167167 return new $class( $this );
@@ -174,14 +174,14 @@
175175 }
176176
177177 if ( !class_exists( $class ) ) {
178 - throw new MWException( "Checker class $class does not exists" );
 178+ throw new MWException( "Checker class $class does not exist." );
179179 }
180180
181181 $checker = new $class( $this );
182182 $checks = $this->getFromConf( 'CHECKER', 'checks' );
183183
184184 if ( !is_array( $checks ) ) {
185 - throw new MWException( "Checker class $class not supplied with proper checks" );
 185+ throw new MWException( "Checker class $class not supplied with proper checks." );
186186 }
187187
188188 foreach ( $checks as $check ) {
@@ -201,7 +201,7 @@
202202 }
203203
204204 if ( !class_exists( $class ) ) {
205 - throw new MWException( "Mangler class $class does not exists" );
 205+ throw new MWException( "Mangler class $class does not exist." );
206206 }
207207
208208 /**
@@ -352,7 +352,7 @@
353353 $index = $wgContLang->getNsIndex( $ns );
354354
355355 if ( !$index ) {
356 - throw new MWException( "No valid namespace defined, got $ns" );
 356+ throw new MWException( "No valid namespace defined, got $ns." );
357357 }
358358
359359 return $index;
@@ -414,7 +414,7 @@
415415
416416 $pattern = $this->getFromConf( 'FILES', 'sourcePattern' );
417417 if ( $pattern === null ) {
418 - throw new MWException( 'No source file pattern defined' );
 418+ throw new MWException( 'No source file pattern defined.' );
419419 }
420420
421421 return $this->replaceVariables( $pattern, $code );
@@ -424,7 +424,7 @@
425425 $pattern = $this->getFromConf( 'FILES', 'targetPattern' );
426426
427427 if ( $pattern === null ) {
428 - throw new MWException( 'No target file pattern defined' );
 428+ throw new MWException( 'No target file pattern defined.' );
429429 }
430430
431431 return $this->replaceVariables( $pattern, $code );
@@ -486,19 +486,19 @@
487487 $path = $this->getFromConf( 'BASIC', 'metadataPath' );
488488
489489 if ( $path === null ) {
490 - throw new MWException( "metadataPath is not configured" );
 490+ throw new MWException( "metadataPath is not configured." );
491491 }
492492
493493 $filename = "$path/messageTypes.inc";
494494
495495 if ( !is_readable( $filename ) ) {
496 - throw new MWException( "$filename is not readable" );
 496+ throw new MWException( "$filename is not readable." );
497497 }
498498
499499 $data = file_get_contents( $filename );
500500
501501 if ( $data === false ) {
502 - throw new MWException( "Failed to read $filename" );
 502+ throw new MWException( "Failed to read $filename." );
503503 }
504504
505505 $reader = new ConfEditor( $data );

Status & tagging log