diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-08-09 22:03:20 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-08-09 22:03:36 +0200 |
commit | 5d56a255700c4d80a3c346d7ce4648c62e45d8f1 (patch) | |
tree | 458d8ab29ad5e7a6f0378bc20180f7f909185d9e /pyload/web/app/scripts/helpers/formatSize.js | |
parent | UnrestrictLi: merged #215 (diff) | |
download | pyload-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.js | 7 |
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]; |