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 605 forks source link

Currencies: Support optional grouping, decimal data, and pattern elements #831

Open rxaviers opened 6 years ago

rxaviers commented 6 years ago

Ref: similar issue than reported in https://github.com/tc39/ecma402/issues/241

Globalize("pt-PT").formatCurrency(1, "PTE");
> "1,00 ​"

UTS#35 says:

Currencies can also contain optional grouping, decimal data, and pattern elements. This data is inherited from the in the same locale data (if not present in the chain up to root), so only the differing data will be present. See the main document Section 4.1 Multiple Inheritance.

Example: https://github.com/unicode-cldr/cldr-numbers-full/blob/master/main/pt-PT/currencies.json#L1303-L1310