r107744 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107743‎ | r107744 | r107745 >
Date:21:32, 31 December 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Followup r107743, use messages in formatBitrate

Add method description
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -3806,11 +3806,14 @@
38073807 }
38083808
38093809 /**
 3810+ * Format a bitrate for output, using an appropriate
 3811+ * unit (bps, kbps, Mbps, Gbps, Tbps, Pbps, Ebps, Zbps or Ybps) according to the magnitude in question
 3812+ *
38103813 * @param $bps int
38113814 * @return string
38123815 */
38133816 function formatBitrate( $bps ) {
3814 - $units = array( 'bps', 'kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps' );
 3817+ $units = array( '', 'kibi', 'mebi', 'gibi', 'tebi', 'pebi', 'exbi', 'zebi', 'yobi' );
38153818 if ( $bps <= 0 ) {
38163819 return $this->formatNum( $bps ) . $units[0];
38173820 }
@@ -3821,7 +3824,9 @@
38223825 } else {
38233826 $mantissa = round( $mantissa );
38243827 }
3825 - return $this->formatNum( $mantissa ) . $units[$unitIndex];
 3828+ $msg = "bitrate-{$units[$unitIndex]}bits";
 3829+ $text = $this->getMessageFromDB( $msg );
 3830+ return str_replace( '$1', $this->formatNum( $mantissa ), $text );
38263831 }
38273832
38283833 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r107746Fixup r107744, r107743reedy21:54, 31 December 2011
r107747Fix 0bps or less...reedy21:57, 31 December 2011
r107780Fix fixme on r107744 (though, I'm guessing r107743 is at fault, for not addin...reedy20:16, 1 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107743Message-ify bitrate units...reedy21:30, 31 December 2011

Comments

#Comment by Raymond (talk | contribs)   20:11, 1 January 2012

Some of these revision:

In Translatewiki:

PHP Notice: Undefined index: bitrateunits in /www/w/extensions/Translate/ffs/Wiki.php on line 141

In my local installation:

PHP Notice: Undefined index: bitrateunits in D:\F_Programmierung\xampp\htdocs\wiki_neu\maintenance\language\writeMessagesArray.inc on line 139
#Comment by Duplicatebug (talk | contribs)   22:19, 6 January 2012

Please let grep find that message names. Thanks.

Status & tagging log