ecma402 icon indicating copy to clipboard operation
ecma402 copied to clipboard

Intl.NumberFormat() - narrowSymbol issue in en-CA culture, USD currency

Open vcechak opened this issue 1 year ago • 6 comments
trafficstars

Hello,

as per "narrowSymbol" Use a narrow format symbol ("$100" rather than "US$100").

Issue: When we use en-CA culture, USD currency the result is not narrow symbol $100, but US$100 (which I would expect if I used "symbol".

Test code: const number = 100; console.log('USD, en-CA: ', new Intl.NumberFormat('en-CA', {currencySign: "standard", currencyDisplay: 'narrowSymbol', style: 'currency', currency: 'USD' }).format( number, ), ); console.log('USD, en-US: ', new Intl.NumberFormat('en-US', {currencySign: "standard", currencyDisplay: 'narrowSymbol', style: 'currency', currency: 'USD' }).format( number, ), );

Code output: "USD, en-CA: " "US$100.00" "USD, en-US: " "$100.00"

PS. it would be good to check also rest of the currencies.

vcechak avatar Feb 09 '24 09:02 vcechak

I can reproduce the stated behavior. It appears the change from "$" to "US$" in en-CA appeared in CLDR 42:

https://www.unicode.org/cldr/charts/42/delta/en.html#Northern%20America:%20United%20States

CC @ptomato @dminor who speak en-CA

I filed an upstream issue in CLDR. If it is a bug, it should be fixed in CLDR, not ECMA-402.

https://unicode-org.atlassian.net/browse/CLDR-17372

sffc avatar Feb 09 '24 21:02 sffc

As an en-CA speaker I don't have a particular opinion on this — $100 by itself when referring to USD 100 is misleading and I wouldn't use it, but if it was clear from context, I think it'd be OK. Maybe a good place to check would be the style guide of a Canadian newspaper, such as the Globe and Mail.

ptomato avatar Feb 09 '24 23:02 ptomato

Yeah Canadian refers to CAD as just $, so USD in en-CA should be US$.

longlho avatar Feb 10 '24 00:02 longlho

To be sure, this report is about the "narrowSymbol" option which is specifically documented as being useful only when there is enough context, such as prices down a column with a heading "USD".

sffc avatar Feb 10 '24 00:02 sffc

Exactly, we have currency specified in the header of the page. In the table we use only symbols, but for better visibility we are using group separators for the thousands and also decimal separator as per the culture of user.

vcechak avatar Feb 22 '24 09:02 vcechak

Upstream fix to land in CLDR 45: https://github.com/unicode-org/cldr/pull/3566

sffc avatar Apr 02 '24 19:04 sffc