1
0

Localized size units in main.js.

This commit is contained in:
Alexander Andreev 2024-12-30 20:39:09 +04:00
parent 6669337d3a
commit 4b188da546
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -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;
}