globalizejs / globalize

A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data
https://globalizejs.com
MIT License
4.8k stars 602 forks source link

Error E_MISSING_CLDR with Globalize.currencyFormatter #948

Open MdWaqas opened 5 months ago

MdWaqas commented 5 months ago

Issue: Error E_MISSING_CLDR with Globalize.currencyFormatter

Description

The Globalize.currencyFormatter function is throwing an E_MISSING_CLDR error when using Globalize.formatCurrencyToParts with certain currencies like BGN (Bulgarian Lev). This issue arises because the new CLDR version does not include symbols for currencies that traditionally do not have symbols.

Error Details

When calling Globalize.formatCurrencyToParts(23.50, 'BGN');, the error message is:

Error: E_MISSING_CLDR: Missing required CLDR content `main/en-US/numbers/currencies/BGN/symbol`.

Background

Previous versions of CLDR provided a default symbol for every currency, regardless of whether it had a symbol in practice. For example, BGN previously had 'BGN' as its symbol in the CLDR, but this is no longer the case in the newer versions.

Questions

Proposed Solution

Actually I am using this function in a function that is in used at 1000s of places so do not want to add the fix that can have bigger impact and can open testing

Globalize.js - Version 1.7.0 CLDR JavaScript Library v0.5.3 2020-08-05T21:43Z @rxaviers

Your insights and suggestions on this matter would be greatly appreciated.