From: Sam Reed Date: Sat, 31 Dec 2011 21:32:42 +0000 (+0000) Subject: Followup r107743, use messages in formatBitrate X-Git-Tag: 1.31.0-rc.0~25648 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=3bbfb9844a5fed74bf3bd9f8e7179460b1d01458;p=lhc%2Fweb%2Fwiklou.git Followup r107743, use messages in formatBitrate Add method description --- diff --git a/languages/Language.php b/languages/Language.php index bb3256c47f..26d7d1fd09 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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 ); } /**