镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Decimal and grouping separator for en-ZA does not align with in-country usage #48120

Description

@abster

What is the problem this feature will solve?

Currently, the built-in number and currency formatting libraries in Node.js return "," (comma) as decimal separator and " " (whitespace) as grouping separator for formatted numbers and currencies in en-ZA (English South Africa) locale.

console.log(new Intl.NumberFormat('en-ZA', { maximumSignificantDigits: 3 }).format(4.56));
// Expected output: "4.56"
// Actual output: "4,56"

console.log(new Intl.NumberFormat('en-ZA', { style: 'currency', currency: 'SAR' }).format(1234.56));
// Expected output: "SAR 1,234.56"
// Actual output: "SAR 1 234,56"

console.log(new IntlMessageFormat(
  'The price is: {price, number, ::currency/SAR}',
  'en-ZA'
).format({price: 1234.56}));
// Expected output: "The price is: SAR 1,234.56"
// Actual output: "The price is: SAR 1 234,56"

Officially, comma is the decimal separator and space is the grouping separator for numbers in en-ZA (https://www.sadev.co.za/content/how-correctly-format-currency-south-africa), however in common usage, price labels in shops, bank documents and statements use period (.) as decimal separator and comma (,) as grouping separator.

For context, check out following CLDR issues:

Decimal separator - South Africa
Decimal and grouping separator for en_ZA does not align with in-country usage

What is the feature you are proposing to solve the problem?

Upgrade CLDR data in NodeJS. The fix for numbers and currencies in en-ZA locale from CLDR is set to be released as part of CLDR 43.1. This CLDR update will be integrated in an upcoming minor release for ICU4C/ICU4J. Node 20 currently uses ICU 73, while Node 18 (current stable release) uses ICU 72.

  • Node 18 - Upgrade to ICU4C 73 and pick up the next minor release (when it is available) including the fix for numbers and currencies in en-ZA locale in CLDR 43.1.
  • Node 20 - Pick up the next minor release for ICU4C 73 (when it is available) including the fix for numbers and currencies in en-ZA locale in CLDR 43.1.

What alternatives have you considered?

Create overrides in our consumer library. Unfortunately, it is not feasible for us to create overrides for every number and price formatting use case.

Activity

  1. aduh95 commented on May 22, 2023

    @aduh95
    Contributor

    @nodejs/i18n

  2. srl295 commented on May 22, 2023

    @srl295
    Member

    @abster Hi! Good to see you here. Yeah, can pick up the ICU dot release when it's available…

  3. Antonius-S commented on Jun 1, 2023

    @Antonius-S
  4. abster commented on Jun 16, 2023

    @abster
    Author

    @Antonius-S From my understanding CLDR data can be updated on a specific ICU major release but updating CLDR data on a previous ICU release may not always be compatible, since CLDR releases are tied to specific ICU major releases.

  5. abster commented on Jun 16, 2023

    @abster
    Author

    Just as a heads-up, ICU 73.2 has been released: https://github.com/unicode-org/icu/releases/tag/release-73-2. Updating node.js to use ICU4C-73.2 should include the fix for en-ZA (addressed in CLDR issue).

  6. richardlau commented on Jun 16, 2023

    @richardlau
    Member

    To set expectations, our automation should pick up the new ICU release over the weekend. There's no reason to rush this any earlier as we won't be able to run the CI on it until the security releases are done next week.

  7. Antonius-S commented on Jun 20, 2023

    @Antonius-S

    @abster

    @Antonius-S From my understanding CLDR data can be updated on a specific ICU major release but updating CLDR data on a previous ICU release may not always be compatible, since CLDR releases are tied to specific ICU major releases.

    According to docs, for external ICU to work, the binary should be built with at most small-icu option so this is just a temporary workaround to solve the issue until new build is ready

  8. abster commented on Jul 7, 2023

    @abster
    Author

    @richardlau - I see that icu version is updated to 73.2 in the main branch: https://github.com/nodejs/node/blob/main/tools/icu/current_ver.dep

    The latest minor release (v18.6.1) for node 18 is however still on 72.1. Do you know when node 18 would be updated to ICU 73.2?

    https://github.com/nodejs/node/blob/v18.16.1/tools/icu/current_ver.dep

  9. richardlau commented on Jul 7, 2023

    @richardlau
    Member

    We usually want changes in a current release for at least two weeks before landing in LTS -- I see #48502 only just recently went out in Node.js 20.4.0 so it might be a bit soon for the being prepared 18.17.0 (#48694).

  10. abster commented on Jul 26, 2023

    @abster
    Author

    @richardlau - The latest minor release (v18.17.0) for node 18 is on ICU 73.1. Do you know when you expect node 18 to be updated to ICU 73.2?

  11. richardlau commented on Jul 26, 2023

    @richardlau
    Member

    Sometime in August according to the current plan in nodejs/Release#737. May be a little clearer after tomorrow's working group meeting where we usually look at the schedules and see who's available to do releases nodejs/Release#886.

  12. srl295 commented on Jul 26, 2023

    @srl295
    Member

    @abster wrote:

    @Antonius-S From my understanding CLDR data can be updated on a specific ICU major release but updating CLDR data on a previous ICU release may not always be compatible, since CLDR releases are tied to specific ICU major releases.

    Hi…

    Correct, prior ICUs cannot be upgraded to arbitrary CLDR versions. If there's enough interest/available hands to help, a CLDR fix could be back-ported to a prior CLDR maint line, which could then be picked up by the corresponding ICU maint line.

  13. abster commented on Sep 1, 2023

    @abster
    Author

    (v18.17.1) is on ICU 73.1. Is there a planned release for node 18, which will include update to ICU 73.2? Also, is there a target release date?

  14. richardlau commented on Sep 1, 2023

    @richardlau
    Member

    FYI @ruyadorno perhaps we can consider the ICU update (#48502) for #49220.

  15. alexmojaki commented on Oct 17, 2023

    @alexmojaki

    Looks like there was a change recently, and I see the two PRs above are merged. Is this done?

  16. aduh95 commented on Oct 17, 2023

    @aduh95
    Contributor

    The ICU update has landed in all supported release lines, I’m going to assume this is fixed. Please comment or reopen if the issue still remains.

  17. icyJoseph commented on Feb 14, 2025

    @icyJoseph

    Hi,

    Using Node 22.12.0, and I still see this issue:

    console.log(new Intl.NumberFormat('en-ZA', { style: 'currency', currency: 'SAR' }).format(1234.56));
    // SAR 1 234,56
    Image

    Whereas, running the same on, say Chrome, returns, SAR 1,234.56. Other browsers, as well as Deno, return the same.

    How can I debug/fix this?

  18. michaelwiles commented on Jul 24, 2025

    @michaelwiles

    So this is still an issue...

    It's challenging as my tests now use a different separator to running in the browser as chrome formats with the dot as the decimal separator in en-ZA...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions