r87651 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87650‎ | r87651 | r87652 >
Date:19:34, 7 May 2011
Author:bawolff
Status:ok
Tags:
Comment:
(bug 28868) Include the number of pages in the default getLongDesc for multipaged documents

This will only include the number of pages if there is at least two pages.
If you have a pdf with a single page, it won't say 1 page. I modeled this
on how animated images will only say x frames if x > 1.

(For reference, this will affect extensions like pdfHandler, but it won't
affect extensions like PagedTiffHandler since that one totally overrides
the default method)
Modified paths:
  • /trunk/phase3/includes/media/Generic.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
@@ -2569,6 +2569,7 @@
25702570 'widthheightpage',
25712571 'file-info',
25722572 'file-info-size',
 2573+ 'file-info-size-pages',
25732574 'file-nohires',
25742575 'svg-long-desc',
25752576 'show-big-image',
Index: trunk/phase3/includes/media/Generic.php
@@ -655,11 +655,22 @@
656656 */
657657 function getLongDesc( $file ) {
658658 global $wgLang;
659 - return wfMsgExt('file-info-size', 'parseinline',
660 - $wgLang->formatNum( $file->getWidth() ),
661 - $wgLang->formatNum( $file->getHeight() ),
662 - $wgLang->formatSize( $file->getSize() ),
663 - $file->getMimeType() );
 659+ $pages = $file->pageCount();
 660+ if ( $pages === false || $pages <= 1 ) {
 661+ $msg = wfMsgExt('file-info-size', 'parseinline',
 662+ $wgLang->formatNum( $file->getWidth() ),
 663+ $wgLang->formatNum( $file->getHeight() ),
 664+ $wgLang->formatSize( $file->getSize() ),
 665+ $file->getMimeType() );
 666+ } else {
 667+ $msg = wfMsgExt('file-info-size-pages', 'parseinline',
 668+ $wgLang->formatNum( $file->getWidth() ),
 669+ $wgLang->formatNum( $file->getHeight() ),
 670+ $wgLang->formatSize( $file->getSize() ),
 671+ $file->getMimeType(),
 672+ $wgLang->formatNum( $pages ) );
 673+ }
 674+ return $msg;
664675 }
665676
666677 /**
Index: trunk/phase3/languages/messages/MessagesQqq.php
@@ -3067,6 +3067,7 @@
30683068 '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.',
30693069 'file-info' => 'File info displayed on file description page.',
30703070 'file-info-size' => 'File info displayed on file description page.',
 3071+'file-info-size-pages' => 'File info displayed on file description page, when the file is a multi-page document, with at least two pages. Like {{msg-mw|file-info-size}} but $5 is the total number of pages in the document.',
30713072 'file-nohires' => 'File info displayed on file description page. For example of message in use see [[:File:Mouse10.gif]].',
30723073 '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]].',
30733074 '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
@@ -3622,6 +3622,7 @@
36233623 'widthheightpage' => '$1×$2, $3 {{PLURAL:$3|page|pages}}',
36243624 'file-info' => 'file size: $1, MIME type: $2',
36253625 'file-info-size' => '$1 × $2 pixels, file size: $3, MIME type: $4',
 3626+'file-info-size-pages' => '$1 × $2 pixels, file size: $3, MIME type: $4, $5 pages',
36263627 'file-nohires' => '<small>No higher resolution available.</small>',
36273628 'svg-long-desc' => 'SVG file, nominally $1 × $2 pixels, file size: $3',
36283629 'show-big-image' => 'Full resolution',

Follow-up revisions

RevisionCommit summaryAuthorDate
r87652(follow-up r87651) whoops, forgot release notes.bawolff19:37, 7 May 2011
r87653Follow-up r87651: PLURAL is needed for other languages with more than 1 plura...raymond19:42, 7 May 2011
r88006bug 28868 removed page number in longdesc in pagedtiffhandler and put in tota...mglaser16:25, 13 May 2011

Status & tagging log