From 5d56a255700c4d80a3c346d7ce4648c62e45d8f1 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 9 Aug 2013 22:03:20 +0200 Subject: new account page layout, added translations for webui --- pyload/web/app/scripts/helpers/formatSize.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pyload/web/app/scripts/helpers/formatSize.js') diff --git a/pyload/web/app/scripts/helpers/formatSize.js b/pyload/web/app/scripts/helpers/formatSize.js index 3b62e74c7..926c4793d 100644 --- a/pyload/web/app/scripts/helpers/formatSize.js +++ b/pyload/web/app/scripts/helpers/formatSize.js @@ -1,10 +1,15 @@ // Format bytes in human readable format -define('helpers/formatSize', ['handlebars'], function(Handlebars) { +define('helpers/formatSize', ['handlebars', './gettext'], function(Handlebars, gettext) { 'use strict'; var sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB']; function formatSize(bytes, options) { if (!bytes || bytes === 0) return '0 B'; + if (bytes === -1) + return gettext('not available'); + if (bytes === -2) + return gettext('unlimited'); + var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10); // round to two digits return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + sizes[i]; -- cgit v1.2.3