From 4b188da5461dbb6a3cf9b6761646df0bad99e95e Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 30 Dec 2024 20:39:09 +0400 Subject: [PATCH] Localized size units in main.js. --- web/assets/js/main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/assets/js/main.js b/web/assets/js/main.js index 945627e..f37fd88 100644 --- a/web/assets/js/main.js +++ b/web/assets/js/main.js @@ -251,9 +251,12 @@ thead_date.addEventListener('click', e => { }); +const size_units = document.getElementsByTagName("html")[0].lang == "ru" ? + {"Б": 0, "КиБ": 1, "МиБ": 2, "ГиБ": 3, "ТиБ": 4} : + {"B": 0, "KiB": 1, "MiB": 2, "GiB": 3, "TiB": 4}; function sizeToBytes(size, unit) { - if (units[unit] == 0) return size; - for (let i = 0; i <= units[unit]; ++i) size *= 1024; + if (size_units[unit] == 0) return size; + for (let i = 0; i <= size_units[unit]; ++i) size *= 1024; return size; }