summaryrefslogtreecommitdiffstats
path: root/pyload/web/app/scripts/helpers/formatSize.js
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-08-09 22:03:20 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-08-09 22:03:36 +0200
commit5d56a255700c4d80a3c346d7ce4648c62e45d8f1 (patch)
tree458d8ab29ad5e7a6f0378bc20180f7f909185d9e /pyload/web/app/scripts/helpers/formatSize.js
parentUnrestrictLi: merged #215 (diff)
downloadpyload-5d56a255700c4d80a3c346d7ce4648c62e45d8f1.tar.xz
new account page layout, added translations for webui
Diffstat (limited to 'pyload/web/app/scripts/helpers/formatSize.js')
-rw-r--r--pyload/web/app/scripts/helpers/formatSize.js7
1 files changed, 6 insertions, 1 deletions
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];