You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Here are two examples, the first correct one is from Chrome 48.0.2564.97 m and the second incorrect is from this polyfill.
currency: IDR,
locales: ru and en.
Browser:
new Intl.NumberFormat(['ru'], {style: 'currency', currency: 'IDR', currencyDisplay: 'name', minimumFractionDigits: 0}).format(500000)
"500 000 индонезийских рупий" // correct name for ru
new Intl.NumberFormat(['en'], {style: 'currency', currency: 'IDR', currencyDisplay: 'name', minimumFractionDigits: 0}).format(500000)
"500,000 Indonesian rupiahs" // correct name for en
Intl.js:
new Intl.NumberFormat(['ru'], {style: 'currency', currency: 'IDR', currencyDisplay: 'name', minimumFractionDigits: 0}).format(500000)
"500 000 IDR" // incorrect name for ru
new Intl.NumberFormat(['en'], {style: 'currency', currency: 'IDR', currencyDisplay: 'name', minimumFractionDigits: 0}).format(500000)
"IDR500,000" // incorrect name for en
The text was updated successfully, but these errors were encountered:
@wzup we intentionally only support currencyDisplay: 'symbol' due to the amount of data that needs to be fetched (locale data) to support "name" and "code", it is a compromise. On top of that, we are only picking up the symbols that are different from the currency identifier, you can see what we fetch here: https://github.com/andyearnshaw/Intl.js/blob/master/locale-data/json/en.json#L2176-L2197
We don't have a plan to solve this in the interim I'm afraid, because it will increase the size of the data required by the polyfill to function, but if someone wants to write a PR that enables to use of those extra entries as part of a custom build, I will be happy to take it. In other words, the default build should still add support for basic functionality, and a custom build can extend the size of the data.
+1 on this as I've been running into this recently as well for ja-JP locale currency formatting. Is there a compromise solution that we can use to only support the "name" field for the main currency or two that the locale supports? e.g. Only supporting JPY for ja-JP and USD for en-US.
An add-on package intl-currency would bring in new currency formats for locales. Its single export could be fed to Intl using Intl.__addLocaleData(locale) which it would simply merge with the existing locales.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Here are two examples, the first correct one is from Chrome
48.0.2564.97 m
and the second incorrect is from this polyfill.currency:
IDR
,locales:
ru
anden
.Browser:
Intl.js:
The text was updated successfully, but these errors were encountered: