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

Currency format to parts #679

Closed rxaviers closed 4 years ago

rxaviers commented 7 years ago

Context

Formatter is designed to provide an opaque string as an output that is not meant to be manipulated by the consumer, which makes impossible for UX/design using rich formatting, e.g., "<strong>EUR</strong> 35".

Goal

Expose format to parts similarly to Ecma-402 Intl.DateTimeFormat.prototype.formatToParts().

References

patch commented 7 years ago

currencyToPartsFormatter would be very useful for several projects that I'm working on, not just for access to the currency sign but also for access to the different number parts for stylizing dollars and cents (and their equivalents in other currencies) in different formats.

rxaviers commented 7 years ago

@patch is anyone from your team willing to work on it? It's a straightforward change. This diff can be used as baseline and I'd be available to guide.

patch commented 7 years ago

Potentially. I'll review the changes for dateToPartsFormatter and start out with the spec for currencyToPartsFormatter. Fortunately we now have a solid date-based part formatter to work from. (By the way, great new feature! Thanks!)

rxaviers commented 7 years ago

Excellent and thank you! :)

TheDutchDevil commented 6 years ago

Are there any updates on this? As we recently ran into this issue.

rxaviers commented 6 years ago

Hi @TheDutchDevil, this has stalled. Do you want to contribute this feature. It should be a straightforward additioanl and it can use date to parts as baseline as mentioned above. Thanks

TheDutchDevil commented 6 years ago

I would love to add it in, however, I just don't have the hours for it. :( Especially as the diff you linked appears to look quite involved.

rxaviers commented 6 years ago

Funny if not sad, we all would love to do a lot of things, the problem are the hours for them.