r59851 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59850‎ | r59851 | r59852 >
Date:22:03, 8 December 2009
Author:tomasz
Status:ok (Comments)
Tags:
Comment:
Picking up fixes from r59715#c4688
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialNoticeText.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialNoticeText.php
@@ -167,13 +167,10 @@
168168 }
169169
170170 private function formatNum( $num ) {
171 - // Reduce to millions
172 - $num *= 0.000001;
173 - // Grab the fractional part
174 - $fraction = ( round( $num - 0.0455555, 1, PHP_ROUND_HALF_DOWN ) - floor( $num ) ) * 10;
175 - // Only append the fractional part if it's more than 0
176 - $num = floatval( floor( $num ) . ( $fraction ? '.' . $fraction : '' ) );
177 - // Internationalize
 171+ $num = sprintf("%.1f", $num/1e6);
 172+ if ( substr( $num, -2 ) == '.0' ) {
 173+ $num = substr( $num, 0, -2 );
 174+ }
178175 $lang = Language::factory( $this->language );
179176 return $lang->formatNum( $num );
180177 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r59852Picking up r59194, r59851 and new translationstomasz22:08, 8 December 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59715Added formatting for contribution total to be in decimal millions like 1 or 1...tparscal23:47, 3 December 2009

Comments

#Comment by Nikerabbit (talk | contribs)   07:22, 9 December 2009

Missing indentation?

Status & tagging log