Skip to content

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

Closed
@abster

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions