Skip to content
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

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

Open
vcechak opened this issue Feb 9, 2024 · 6 comments
Open
Labels
c: numbers Component: numbers, currency, units Data Related to locale data s: blocked Status: the issue is blocked on upstream

Comments

@vcechak
Copy link

vcechak commented Feb 9, 2024

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.

@sffc sffc added c: numbers Component: numbers, currency, units s: blocked Status: the issue is blocked on upstream Data Related to locale data labels Feb 9, 2024
@sffc
Copy link
Contributor

sffc commented Feb 9, 2024

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

@ptomato
Copy link
Contributor

ptomato commented Feb 9, 2024

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.

@longlho
Copy link
Collaborator

longlho commented Feb 10, 2024

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

@sffc
Copy link
Contributor

sffc commented Feb 10, 2024

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".

@vcechak
Copy link
Author

vcechak commented Feb 22, 2024

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.

@sffc
Copy link
Contributor

sffc commented Apr 2, 2024

Upstream fix to land in CLDR 45: unicode-org/cldr#3566

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: numbers Component: numbers, currency, units Data Related to locale data s: blocked Status: the issue is blocked on upstream
Projects
None yet
Development

No branches or pull requests

4 participants