2015-02-14 00:17:40 +01:00
|
|
|
function getLocalString(language, descriptor){
|
|
|
|
if(global_strings[language]){
|
|
|
|
return global_strings[language][descriptor] || global_strings["english"][descriptor] || descriptor
|
|
|
|
} else {
|
|
|
|
return descriptor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getDescriptorByLocalString(language, localString){
|
|
|
|
for(string in global_strings[language]){
|
|
|
|
if(global_strings[language][string] == localString){
|
|
|
|
return string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return localString
|
|
|
|
}
|
2017-12-28 08:36:44 +01:00
|
|
|
|
|
|
|
function getNextUnit(bSize) {
|
|
|
|
units = ["B", "kB", "MB", "GB", "TB", "PB", "To damn high"]
|
|
|
|
iters = 0
|
|
|
|
size = bSize
|
|
|
|
do {
|
|
|
|
size /= 1024
|
|
|
|
iters++
|
|
|
|
} while(size >= 1)
|
|
|
|
size *= 1024
|
|
|
|
if(iters > units.length) { iters = units.length }
|
|
|
|
return [size, units[iters - 1]]
|
|
|
|
}
|
|
|
|
|