From 1031c19779d4cd6764dab6fbc8360cc99ff83409 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 26 Jan 2014 17:11:24 +0100 Subject: Formatage nombres MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/395 --- app/views/configure/archiving.phtml | 2 +- lib/lib_rss.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 6e26ca81e..e144d0f45 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -39,7 +39,7 @@

-

nb_total, ' ', Minz_Translate::t('articles'), ', ', formatBytes($this->size_user); ?>

+

nb_total), ' ', Minz_Translate::t('articles'), ', ', formatBytes($this->size_user); ?>

diff --git a/lib/lib_rss.php b/lib/lib_rss.php index ba5b01112..28cd99874 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -62,6 +62,11 @@ function small_hash ($txt) { return strtr ($t, '+/', '-_'); } +function formatNumber($n, $precision = 0) { + return str_replace(' ', ' ', //Espace fine insécable + number_format($n, $precision, '.', ' ')); //number_format does not seem to be Unicode-compatible +} + function formatBytes($bytes, $precision = 2, $system = 'IEC') { if ($system === 'IEC') { $base = 1024; @@ -74,7 +79,7 @@ function formatBytes($bytes, $precision = 2, $system = 'IEC') { $pow = $bytes === 0 ? 0 : floor(log($bytes) / log($base)); $pow = min($pow, count($units) - 1); $bytes /= pow($base, $pow); - return round($bytes, $precision) . ' ' . $units[$pow]; + return formatNumber($bytes, $precision) . ' ' . $units[$pow]; } function timestamptodate ($t, $hour = true) { -- cgit v1.2.3