Closed catamphetamine closed 5 years ago
That would be a much better solution to #93, which is more or less a hack.
It's still not a proper localization because it doesn't translate messages.
messages?
A user passing locale: de
property would expect the units to be translated into German.
Also your code will break when there's no .toLocaleString()
.
those are separate features; a language pack of custom symbols or full form words can be loaded into the instance. providing all variations is something i wouldn't attempt for free.
Then locale
doesn't actually localize things.
the method has always existed, it just wasn't used in this lib.
That table only shows the latest verions of browsers. The method couldn't "always exist" because it's not possible. Your code will still break in older browsers.
locale
actually does it's job in regards to the number, e.g. 1000000.24' in 'de' would be
1.000.000,24` which is only something you'd get for an exceptionally large number; majority will be under 3 significant digits.
locale
actually does it's job in regards to the number
locale
only does it's job in regards to the number.
You should state that it doesn't localize the units.
locale
actually does it's job in regards to the number
locale
only does it's job in regards to the number. You should state that it doesn't localize the units.
are you grasping what you're suggesting? a language pack for all permutations is unmanageable.
as per your claim of support... https://caniuse.com/#feat=internationalization
a language pack for all permutations is unmanageable.
Nothing "unmanageable" in that.
as per your claim of support... https://caniuse.com/#feat=internationalization
As per your claim of support: the link clearly shows that it's not supported in all browsers. So your code will break.
i don't care if my code breaks in a deprecated browser that only runs in an OS that's 10+ years out dated. I just don't care. I don't care if you want this feature to work on modern browsers and netscape 1.0.
You're not paying me money, so I don't care.
I don't care about what you care and don't care. You're a low-skill develoepr.
And yet you opened this ticket, and it gets over 4 million installs a week.
I don't care if you care or not. I did you a favor.
I can see that your library supports some localization via
separator
,symbols
andfullforms
. I guess, for Russian it would be something like:You could make a directory called
locales
where people could submit pull requests with their languages.A similar API: https://github.com/sindresorhus/pretty-bytes#readme
Notice how they also use
,
in that example. That's because they usenumber.toLocaleString()
instead ofseparator
. They should have also checked fornumber.toLocaleString
existence before using it and then fall back to a default separator. They also don't havekB
translated.These are localization API ideas you might want to review in some future if you decide on adding localization to this library. I don't need localization, I'm using
en-US
.