Followup r107743, use messages in formatBitrate
authorSam Reed <reedy@users.mediawiki.org>
Sat, 31 Dec 2011 21:32:42 +0000 (21:32 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 31 Dec 2011 21:32:42 +0000 (21:32 +0000)
Add method description

languages/Language.php

index bb3256c..26d7d1f 100644 (file)
@@ -3806,11 +3806,14 @@ class Language {
        }
 
        /**
+        * Format a bitrate for output, using an appropriate
+        * unit (bps, kbps, Mbps, Gbps, Tbps, Pbps, Ebps, Zbps or Ybps) according to the magnitude in question
+        *
         * @param $bps int
         * @return string
         */
        function formatBitrate( $bps ) {
-               $units = array( 'bps', 'kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps' );
+               $units = array( '', 'kibi', 'mebi', 'gibi', 'tebi', 'pebi', 'exbi', 'zebi', 'yobi' );
                if ( $bps <= 0 ) {
                        return $this->formatNum( $bps ) . $units[0];
                }
@@ -3821,7 +3824,9 @@ class Language {
                } else {
                        $mantissa = round( $mantissa );
                }
-               return $this->formatNum( $mantissa ) . $units[$unitIndex];
+               $msg = "bitrate-{$units[$unitIndex]}bits";
+               $text = $this->getMessageFromDB( $msg );
+               return str_replace( '$1', $this->formatNum( $mantissa ), $text );
        }
 
        /**