Index: trunk/phase3/includes/media/Generic.php |
— | — | @@ -380,8 +380,10 @@ |
381 | 381 | * Note, everything here is passed through the parser later on (!) |
382 | 382 | */ |
383 | 383 | protected static function addMeta( &$array, $visibility, $type, $id, $value, $param = false ) { |
384 | | - $msgName = "$type-$id"; |
385 | | - if ( wfEmptyMsg( $msgName ) ) { |
| 384 | + $msg = wfMessage( "$type-$id", $param ); |
| 385 | + if ( $msg->exists() ) { |
| 386 | + $name = $msg->text(); |
| 387 | + } else { |
386 | 388 | // This is for future compatibility when using instant commons. |
387 | 389 | // So as to not display as ugly a name if a new metadata |
388 | 390 | // property is defined that we don't know about |
— | — | @@ -389,8 +391,6 @@ |
390 | 392 | // by default). |
391 | 393 | wfDebug( __METHOD__ . ' Unknown metadata name: ' . $id . "\n" ); |
392 | 394 | $name = wfEscapeWikiText( $id ); |
393 | | - } else { |
394 | | - $name = wfMsg( $msgName, $param ); |
395 | 395 | } |
396 | 396 | $array[$visibility][] = array( |
397 | 397 | 'id' => "$type-$id", |
— | — | @@ -404,10 +404,7 @@ |
405 | 405 | * @return string |
406 | 406 | */ |
407 | 407 | function getShortDesc( $file ) { |
408 | | - global $wgLang; |
409 | | - $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ), |
410 | | - $wgLang->formatNum( $file->getSize() ) ); |
411 | | - return "$nbytes"; |
| 408 | + return wfMessage( 'nbytes' )->numParams( $file->getSize() )->escaped(); |
412 | 409 | } |
413 | 410 | |
414 | 411 | /** |
— | — | @@ -416,9 +413,8 @@ |
417 | 414 | */ |
418 | 415 | function getLongDesc( $file ) { |
419 | 416 | global $wgLang; |
420 | | - return wfMsgExt( 'file-info', 'parseinline', |
421 | | - $wgLang->formatSize( $file->getSize() ), |
422 | | - $file->getMimeType() ); |
| 417 | + return wfMessage( 'file-info', $wgLang->formatSize( $file->getSize() ), |
| 418 | + $file->getMimeType() )->parse(); |
423 | 419 | } |
424 | 420 | |
425 | 421 | /** |
— | — | @@ -426,10 +422,7 @@ |
427 | 423 | * @return string |
428 | 424 | */ |
429 | 425 | static function getGeneralShortDesc( $file ) { |
430 | | - global $wgLang; |
431 | | - $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ), |
432 | | - $wgLang->formatNum( $file->getSize() ) ); |
433 | | - return "$nbytes"; |
| 426 | + return wfMessage( 'nbytes' )->numParams( $file->getSize() )->escaped(); |
434 | 427 | } |
435 | 428 | |
436 | 429 | /** |
— | — | @@ -438,9 +431,8 @@ |
439 | 432 | */ |
440 | 433 | static function getGeneralLongDesc( $file ) { |
441 | 434 | global $wgLang; |
442 | | - return wfMsgExt( 'file-info', 'parseinline', |
443 | | - $wgLang->formatSize( $file->getSize() ), |
444 | | - $file->getMimeType() ); |
| 435 | + return wfMessage( 'file-info', $wgLang->formatSize( $file->getSize() ), |
| 436 | + $file->getMimeType() )->parse(); |
445 | 437 | } |
446 | 438 | |
447 | 439 | /** |
— | — | @@ -712,10 +704,8 @@ |
713 | 705 | * @return string |
714 | 706 | */ |
715 | 707 | function getShortDesc( $file ) { |
716 | | - global $wgLang; |
717 | | - $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ), |
718 | | - $wgLang->formatNum( $file->getSize() ) ); |
719 | | - $widthheight = wfMsgHtml( 'widthheight', $wgLang->formatNum( $file->getWidth() ) ,$wgLang->formatNum( $file->getHeight() ) ); |
| 708 | + $nbytes = wfMessage( 'nbytes' )->numParams( $file->getSize() )->escaped(); |
| 709 | + $widthheight = wfMessage( 'widthheight' )->numParams( $file->getWidth(), $file->getHeight() )->escaped(); |
720 | 710 | |
721 | 711 | return "$widthheight ($nbytes)"; |
722 | 712 | } |
— | — | @@ -728,18 +718,13 @@ |
729 | 719 | global $wgLang; |
730 | 720 | $pages = $file->pageCount(); |
731 | 721 | if ( $pages === false || $pages <= 1 ) { |
732 | | - $msg = wfMsgExt('file-info-size', 'parseinline', |
733 | | - $wgLang->formatNum( $file->getWidth() ), |
734 | | - $wgLang->formatNum( $file->getHeight() ), |
735 | | - $wgLang->formatSize( $file->getSize() ), |
736 | | - $file->getMimeType() ); |
| 722 | + $msg = wfMessage( 'file-info-size' )->numParams( $file->getWidth(), |
| 723 | + $file->getHeight() )->params( $wgLang->formatSize( $file->getSize() ), |
| 724 | + $file->getMimeType() )->parse(); |
737 | 725 | } else { |
738 | | - $msg = wfMsgExt('file-info-size-pages', 'parseinline', |
739 | | - $wgLang->formatNum( $file->getWidth() ), |
740 | | - $wgLang->formatNum( $file->getHeight() ), |
741 | | - $wgLang->formatSize( $file->getSize() ), |
742 | | - $file->getMimeType(), |
743 | | - $wgLang->formatNum( $pages ) ); |
| 726 | + $msg = wfMessage( 'file-info-size-pages' )->numParams( $file->getWidth(), |
| 727 | + $file->getHeight() )->params( $wgLang->formatSize( $file->getSize() ), |
| 728 | + $file->getMimeType() )->numParams( $pages )->parse(); |
744 | 729 | } |
745 | 730 | return $msg; |
746 | 731 | } |
— | — | @@ -749,16 +734,11 @@ |
750 | 735 | * @return string |
751 | 736 | */ |
752 | 737 | function getDimensionsString( $file ) { |
753 | | - global $wgLang; |
754 | 738 | $pages = $file->pageCount(); |
755 | | - $width = $wgLang->formatNum( $file->getWidth() ); |
756 | | - $height = $wgLang->formatNum( $file->getHeight() ); |
757 | | - $pagesFmt = $wgLang->formatNum( $pages ); |
758 | | - |
759 | 739 | if ( $pages > 1 ) { |
760 | | - return wfMsgExt( 'widthheightpage', 'parsemag', $width, $height, $pagesFmt ); |
| 740 | + return wfMessage( 'widthheightpage' )->numParams( $file->getWidth(), $file->getHeight(), $pages )->text(); |
761 | 741 | } else { |
762 | | - return wfMsg( 'widthheight', $width, $height ); |
| 742 | + return wfMessage( 'widthheight' )->numParams( $file->getWidth(), $file->getHeight() )->text(); |
763 | 743 | } |
764 | 744 | } |
765 | 745 | } |