avoidwork / filesize.js

JavaScript library to generate a human readable String describing the file size
https://filesizejs.com
BSD 3-Clause "New" or "Revised" License
1.61k stars 97 forks source link

Add localization addons #64

Closed Grawl closed 9 years ago

Grawl commented 9 years ago

I suggest to create right-crafted localization javascript files to choose from (or better detect automatically), something like filesize.ru.js with following content:

{
    "B": "Б",
    "kB": "кБ",
    "MB": "МБ",
    "GB": "ГБ",
    "TB": "ТБ",
    "PB": "ПБ",
    "EB": "ЭБ",
    "ZB": "ЗБ",
    "YB": "ЙБ"
}

...but with right context.

And call to PR new languages.

avoidwork commented 9 years ago

I've often considered the gap in the API design around this particular issue, it's not curry friendly. I think this could be solved with a facade.

How would you use this? Would you detect the locale & load one of many files? Can we extend the current lib to make this configuration easier?

avoidwork commented 9 years ago

The obvious/simple & breaking change is to reverse the arguments so you can curry the config.

avoidwork commented 9 years ago

Closing due to lack of input, and the fact that you can do this with the config descriptor today.