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

Question: Support localize converting ? #93

Closed ahnpnl closed 6 years ago

ahnpnl commented 6 years ago

Hi,

I checked the document of filesize.js about converting to localized number but I couldn't find any options. Does filesize.js support converting to localized number ? For example in UK they use dot as decimal separator while some other countries they use comma

avoidwork commented 6 years ago

Hi,

At this time it does not. If I were to add that, it would probably just be specifying a delimiter (default would be ""). How does that sound?

avoidwork commented 6 years ago

Follow up question, if your formatting with a period, how do you know what's the decimal place?

ahnpnl commented 6 years ago

Hi, I think providing an option to specify the delimiter sounds good. What I have in mind is after your library finishes the part of calculating the number, taking the option delimiter which the user passes in and use it to replace your comma. What do you think ? I don't know if the calculation needs to take into account of thousand separator as well or not

avoidwork commented 6 years ago

oic, i misunderstood; shouldn't be a problem landing this.

ahnpnl commented 6 years ago

Perhaps providing an optional thousand separator input and also an optional decimal separator input looks better for me :) We don't know who wants to have thousand separator in their codes even though I don't see that case that often