globalizejs / globalizejs/globalize-compiler

Better support multiple currencies with the same format options

Open
#44 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10
Forks
14
PR merge metrics
No merged PRs in 30d

Description

Creating a new issue that is related to some discussion I saw in #10 to talk about having the compiler support automatically "pre-compiling" each `currencyFormatter` with a pre-set list of currencies provided separately. In cases where the currency may be dynamically chosen, but from a set of known values, it would be much simpler to be able to declare the formatter once, and have the compiler automatically expand this.

A similar behavior could be added for units, which I believe has a similar pattern.

I'm not sure how to implement this, but as far as API goes, having another property on `options` passed to `compile()`, such as `supportedCurrencies/supportedUnits` seems like the right approach. Without this present, the compiler would take the formatters literally, but with them present (or, perhaps with them present with a special sentinel value for currency/units), it would auto-expand and generate individual formatters for each of the passed in currencies/units.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.