-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal for Currency List #376
Comments
Currency display names are in https://github.com/tc39/proposal-intl-displaynames For symbols, the problem is that there's no such thing as a universal symbol for a currency. The symbol depends on several factors:
Can you provide more context for where this feature would be both useful and the correct thing to do from an i18n perspective? |
I think I'm talking about: whereas in order to populate the list we typically have to hydrate down a Reference: |
If an application has a fixed list of supported currencies, they will be able to do something like, const currencyCodes = ["ARS", "AUD", "BGN", "BRL", "CAD"];
const intlNames = new Intl.DisplayNames(undefined, { type: "currency" });
const currencyNames = currencyCodes.map((currencyCode) => {
return intlNames.of(currencyCode);
}); Is there something you'd like to see that isn't already supported by the Intl.DisplayNames proposal? |
Ah that'd take care of the display name part. Thanks! |
You're looking for a database, not API. I don't think we should grow the API surface to cover geopolitical data like population, major languages or currencies... I think it's out of scope of JS core API |
For what country uses the currency, that's specified by ISO as the first two letters of the currency code, so you can already infer that. For default fraction digits, I'm not excited about exposing that in API. We've had problems before where people use the CLDR default fraction digits in order to decide the precision to store in a database, for example, and then the CLDR data changes, and it causes problems. Also, not all browsers will have the same data, and we should be conservative when adding ILD features that affect people's money. It's hard to think of a legitimate use case for that information that isn't already covered by formatToParts on Intl.NumberFormat, which respects the default fraction digits. |
gotcha tks for the context! |
Hi there,
Has there been any proposals on exposing Currency List and/or has this been discussed before? This is a very common use case in the finance world where list of currency (along w/ symbols & display names) has to be hydrated from the server side.
Thanks!
The text was updated successfully, but these errors were encountered: