r105917 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105916‎ | r105917 | r105918 >
Date:19:12, 12 December 2011
Author:cneubauer
Status:deferred
Tags:
Comment:
Followon to r104568. Move some messages to message file.
Modified paths:
  • /trunk/extensions/UploadLocal/UploadLocal.i18n.php (modified) (history)
  • /trunk/extensions/UploadLocal/UploadLocalForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadLocal/UploadLocal.i18n.php
@@ -42,5 +42,16 @@
4343 ' descriptions, make sure you give a few linebreaks before/after'.
4444 ' the text.',
4545
 46+ 'uploadlocal_error_exists' => 'The file $1 already exists',
 47+ 'uploadlocal_error_empty' => 'The file you submitted was empty',
 48+ 'uploadlocal_error_missing' => 'The file is missing an extension',
 49+ 'uploadlocal_error_badtype' => 'This type of file is banned',
 50+ 'uploadlocal_error_tooshort' => 'The filename is too short',
 51+ 'uploadlocal_error_illegal' => 'The filename is not allowed',
 52+ 'uploadlocal_error_overwrite' => 'Overwriting an existing file is not allowed',
 53+ 'uploadlocal_error_verify' => 'This file did not pass file verification: $1',
 54+ 'uploadlocal_error_hook' => 'The modification you tried to make was aborted by an extension hook',
 55+ 'uploadlocal_error_unknown' => 'An unknown error occurred',
 56+
4657 'right-uploadlocal' => 'Upload files from the local machine'
4758 );
Index: trunk/extensions/UploadLocal/UploadLocalForm.php
@@ -37,11 +37,11 @@
3838 # Check for warnings like the file already exists in the wiki
3939 $warnings = $this->upload->checkWarnings();
4040 if ( $warnings && isset( $warnings['exists'] ) && $warnings['exists']['warning'] != 'was-deleted' ) {
41 - $this->uploadError( 'The file '.$warnings['exists']['file']->getName().' already exists' );
 41+ $this->uploadError( wfMsg( 'uploadlocal_error_exists', $warnings['exists']['file']->getName() ) );
4242 return;
4343 }
4444
45 - # Check for verificatoins that the upload succeded.
 45+ # Check for verifications that the upload succeded.
4646 $verification = $this->upload->verifyUpload();
4747 if ( $verification['status'] === UploadBase::OK ) {
4848 $this->upload->performUpload( $this->comment, $this->comment, $this->watch, $user );
@@ -51,32 +51,32 @@
5252 } else {
5353 switch( $verification['status'] ) {
5454 case UploadBase::EMPTY_FILE:
55 - $this->uploadError( 'The file you submitted was empty' );
 55+ $this->uploadError( wfMsg( 'uploadlocal_error_empty' ) );
5656 break;
5757 case UploadBase::FILETYPE_MISSING:
58 - $this->uploadError( 'The file is missing an extension' );
 58+ $this->uploadError( wfMsg( 'uploadlocal_error_missing' ) );
5959 break;
6060 case UploadBase::FILETYPE_BADTYPE:
6161 global $wgFileExtensions;
62 - $this->uploadError( 'This type of file is banned' );
 62+ $this->uploadError( wfMsg( 'uploadlocal_error_badtype' ) );
6363 break;
6464 case UploadBase::MIN_LENGTH_PARTNAME:
65 - $this->uploadError( 'The filename is too short' );
 65+ $this->uploadError( wfMsg( 'uploadlocal_error_tooshort' ) );
6666 break;
6767 case UploadBase::ILLEGAL_FILENAME:
68 - $this->uploadError( 'The filename is not allowed' );
 68+ $this->uploadError( wfMsg( 'uploadlocal_error_illegal' ) );
6969 break;
7070 case UploadBase::OVERWRITE_EXISTING_FILE:
71 - $this->uploadError( 'Overwriting an existing file is not allowed' );
 71+ $this->uploadError( wfMsg( 'uploadlocal_error_overwrite' ) );
7272 break;
7373 case UploadBase::VERIFICATION_ERROR:
74 - $this->uploadError( 'This file did not pass file verification: ' . $verification['details'][0] );
 74+ $this->uploadError( wfMsg( 'uploadlocal_error_verify', $verification['details'][0] ) );
7575 break;
7676 case UploadBase::HOOK_ABORTED:
77 - $this->uploadError( "The modification you tried to make was aborted by an extension hook" );
 77+ $this->uploadError( wfMsg( 'uploadlocal_error_hook' ) );
7878 break;
7979 default:
80 - $this->uploadError( 'An unknown error occurred' );
 80+ $this->uploadError( wfMsg( 'uploadlocal_error_unknown' ) );
8181 break;
8282 }
8383 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104568Update for 1.17. This probably breaks compatibility with <= 1.15 and possibl...cneubauer15:33, 29 November 2011

Status & tagging log