r79964 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79963‎ | r79964 | r79965 >
Date:22:18, 10 January 2011
Author:hartman
Status:resolved (Comments)
Tags:
Comment:
Move the () surrounding description strings of files, out of the description and into the interface.

Follows up r68324 and r68325
Modified paths:
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/media/GIF.php (modified) (history)
  • /trunk/phase3/includes/media/Generic.php (modified) (history)
  • /trunk/phase3/includes/media/PNG.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesQqq.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -2560,6 +2560,7 @@
25612561 'widthheightpage',
25622562 'file-info',
25632563 'file-info-size',
 2564+ 'file-info-wrapper',
25642565 'file-nohires',
25652566 'svg-long-desc',
25662567 'show-big-image',
Index: trunk/phase3/includes/ImagePage.php
@@ -330,7 +330,7 @@
331331 $height_orig = $this->displayImg->getHeight( $page );
332332 $height = $height_orig;
333333
334 - $longDesc = $this->displayImg->getLongDesc();
 334+ $longDesc = wfMsgExt( 'file-info-wrapper', 'parseinline', $this->displayImg->getLongDesc() );
335335
336336 wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this, &$wgOut ) );
337337
Index: trunk/phase3/includes/media/Generic.php
@@ -240,8 +240,8 @@
241241
242242 function getShortDesc( $file ) {
243243 global $wgLang;
244 - $nbytes = '(' . wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
245 - $wgLang->formatNum( $file->getSize() ) ) . ')';
 244+ $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
 245+ $wgLang->formatNum( $file->getSize() ) );
246246 return "$nbytes";
247247 }
248248
@@ -255,8 +255,8 @@
256256
257257 static function getGeneralShortDesc( $file ) {
258258 global $wgLang;
259 - $nbytes = '(' . wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
260 - $wgLang->formatNum( $file->getSize() ) ) . ')';
 259+ $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
 260+ $wgLang->formatNum( $file->getSize() ) );
261261 return "$nbytes";
262262 }
263263
Index: trunk/phase3/includes/media/PNG.php
@@ -63,7 +63,7 @@
6464 return $original;
6565
6666 $info = array();
67 - $info[] = substr( $original, 1, strlen( $original )-2 );
 67+ $info[] = $original;
6868
6969 if ($metadata['loopCount'] == 0)
7070 $info[] = wfMsgExt( 'file-info-png-looped', 'parseinline' );
@@ -76,9 +76,7 @@
7777 if ($metadata['duration'])
7878 $info[] = $wgLang->formatTimePeriod( $metadata['duration'] );
7979
80 - $infoString = $wgLang->commaList( $info );
81 -
82 - return "($infoString)";
 80+ return $wgLang->commaList( $info );
8381 }
8482
8583 }
Index: trunk/phase3/includes/media/GIF.php
@@ -76,7 +76,7 @@
7777
7878 /* Preserve original image info string, but strip the last char ')' so we can add even more */
7979 $info = array();
80 - $info[] = substr( $original, 1, strlen( $original )-2 );
 80+ $info[] = $original;
8181
8282 if ($metadata['looped'])
8383 $info[] = wfMsgExt( 'file-info-gif-looped', 'parseinline' );
@@ -87,8 +87,6 @@
8888 if ($metadata['duration'])
8989 $info[] = $wgLang->formatTimePeriod( $metadata['duration'] );
9090
91 - $infoString = $wgLang->commaList( $info );
92 -
93 - return "($infoString)";
 91+ return $wgLang->commaList( $info );
9492 }
9593 }
Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -594,7 +594,7 @@
595595 if( $img ) {
596596 $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
597597 if( $thumb ) {
598 - $desc = $img->getShortDesc();
 598+ $desc = wfMsgExt( 'file-info-wrapper', 'parseinline', $img->getShortDesc() );
599599 wfProfileOut( __METHOD__ );
600600 // Float doesn't seem to interact well with the bullets.
601601 // Table messes up vertical alignment of the bullets.
Index: trunk/phase3/languages/messages/MessagesQqq.php
@@ -3059,6 +3059,7 @@
30603060 'widthheightpage' => 'This message is used on image pages in the dimensions column in the file history section for images with more than one page. Parameter $1 is the image width (in pixels), parameter $2 is the image height, and parameter $3 is the number of pages.',
30613061 'file-info' => 'File info displayed on file description page.',
30623062 'file-info-size' => 'File info displayed on file description page.',
 3063+'file-info-wrapper' => 'Surrounds file info descriptions',
30633064 'file-nohires' => 'File info displayed on file description page. For example of message in use see [[:File:Mouse10.gif]].',
30643065 'svg-long-desc' => 'Displayed under an SVG image at the image description page. Note that argument 3 is a string that includes the file size unit symbol. See for example [[:File:Yes check.svg]].',
30653066 'show-big-image' => 'Displayed under an image at the image description page, when it is displayed smaller there than it was uploaded.',
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -3602,10 +3602,11 @@
36033603 'thumbsize' => 'Thumbnail size:',
36043604 'widthheight' => '$1×$2', # only translate this message to other languages if you have to change it
36053605 'widthheightpage' => '$1×$2, $3 {{PLURAL:$3|page|pages}}',
3606 -'file-info' => '(file size: $1, MIME type: $2)',
3607 -'file-info-size' => '($1 × $2 pixels, file size: $3, MIME type: $4)',
 3606+'file-info' => 'file size: $1, MIME type: $2',
 3607+'file-info-size' => '$1 × $2 pixels, file size: $3, MIME type: $4',
 3608+'file-info-wrapper' => '($1)',
36083609 'file-nohires' => '<small>No higher resolution available.</small>',
3609 -'svg-long-desc' => '(SVG file, nominally $1 × $2 pixels, file size: $3)',
 3610+'svg-long-desc' => 'SVG file, nominally $1 × $2 pixels, file size: $3',
36103611 'show-big-image' => 'Full resolution',
36113612 'show-big-image-thumb' => '<small>Size of this preview: $1 × $2 pixels</small>',
36123613 'file-info-gif-looped' => 'looped',

Follow-up revisions

RevisionCommit summaryAuthorDate
r79968Update extensions to use the new style getLongDesc() of r79964hartman22:30, 10 January 2011
r79990Follow-up r79964: Use the existing message 'parentheses' instead of introduci...raymond07:37, 11 January 2011
r81389Follow-up r79964: Fix double parsing of file infobtongminh14:07, 2 February 2011
r814021.17: MFT r79915, r79957, r79964, r79990, r80687, r80999, r81006, r81011, r81...catrope16:18, 2 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r68324Add a new PNG parser in order to recognize APNG (animated PNG) images.hartman16:09, 20 June 2010
r68325Don't override the default Bitmap.php information in the longDescription() fo...hartman16:13, 20 June 2010

Comments

#Comment by Bryan (talk | contribs)   13:51, 2 February 2011

You're doing a double parse.

Status & tagging log