Number formatting
I would find it nice if there was a way to format numbers according to the locale.
For instance, the number 1234.56 (as written in Javascript) should be rendered as 1,234.56 in English and 1 234,56 in French.
So it would be amazing if $.i18n('number-of-results', 1234.56) could render as There are 1,234.56 results in English and Il y a 1 234,56 résultats in French.
Apologies if this is already supported somehow, I couldn't figure it out looking at the readme.
The standard function Number.prototype.toLocaleString can of course be used but this has two downsides:
- this will format the number according to the browser's locale, which might not be the same as the one used by this library
- this means supplying this number as a string to jquery.i18n, so we probably break plural support by doing that (I haven't actually tried)
Currently it is not supported in this library. Note that we are not planning to add any new features to jquery.i18n but banana.i18n - a jquery independent modern js library will be the replacement.
What you described would be a good addition, I agree. We at wikimedia has this number formatting feature as part of a mediawiki dependent localization library. But the the digit separator patterns are coming from mediawikibackend. It is a large set of CLDR originated patterns for all supported languages. To support that we may need to copy that data as part of library and incorporate parsing and number separator loigc.
I will create a copy of this issue in banana-i18n repo
Thank you very much, feel free to close this one then!