ecma402
ecma402 copied to clipboard
Add support for more currency symbol variants (e.g. formal)
Currently we support four currencyDisplay values:
- "symbol" to use a localized currency symbol such as €, this is the default value,
- "narrowSymbol" to use a narrow format symbol ("$100" rather than "US$100"),
- "code" to use the ISO currency code,
- "name" to use a localized currency name such as "dollar",
However, CLDR specifies several additional styles. We should consider adding these to ECMA-402.
Feature request for the "formal" style: https://github.com/tc39/ecma402/issues/642
In unicode-org/message-format-wg#915, we added required support for currencyDisplay=formalSymbol and currencyDisplay=never in MF2, but left out the "variant" option that ICU also supports.
It would be useful to add these two options to Intl.NumberFormat.
In researching this, I also found at least this user need for the latter option: https://stackoverflow.com/q/68549027
@sffc When we discussed this on yesterday's call, you raised a concern about "formal" potentially referring to formal symbols of Eastern Asian currencies. Looking into this, CLDR does not provide an alt="formal" for the <symbol> values, but refers to its non-alternate value as the "formal" one. Furthermore, of the Eastern Asian currencies, the only example of something like this that I could find is CNY in Japanese:
let jaSymbol = new Intl.NumberFormat('ja', { style: 'currency', currency: 'CNY', currencyDisplay: 'symbol' });
let jaNarrow = new Intl.NumberFormat('ja', { style: 'currency', currency: 'CNY', currencyDisplay: 'narrowSymbol' });
jaSymbol.format(1); // "元 1.00"
jaNarrow.format(1); // "¥1.00"
Is this what you meant, or something else?
A proposal for this is now available: https://github.com/eemeli/proposal-intl-currency-display-choices
I was thinking of the formal alt variant, such as this one in zh-Hant:
https://github.com/unicode-org/cldr/blob/b8956436c8cbe80e80630013f6e6c09d7b2e9e28/common/main/zh_Hant.xml#L13662
It looks like that case is the only use of alt="formal" in CLDR data, added in CLDR-11190, and there too it's used to differentiate between the $ and NT$ variants, i.e. the "narrow" and "formal" ones that are available for many currencies and locales.
TG2 discussion: https://github.com/tc39/ecma402/blob/main/meetings/notes-2024-11-25.md#add-support-for-more-currency-symbol-variants-eg-formal-643
Proposal: https://github.com/tc39/proposal-intl-currency-display-choices