pint icon indicating copy to clipboard operation
pint copied to clipboard

Compact Currency Formatting

Open YousefEZ opened this issue 1 year ago • 3 comments

Hi I'm having trouble understanding how to patch into how string formatting for a particular Unit. For more context I want to be able to render Currencies in compact form because the quantities that I am dealing with are in the millions, and billions. I wanted the string format to pass through babel.numbers.format_compacy_currency. Is there a potential way of doing this atm?

YousefEZ avatar May 07 '23 15:05 YousefEZ

I would love to know!

MichaelTiemannOSC avatar May 08 '23 21:05 MichaelTiemannOSC

I don't think there's support for this right now (so you'd have to call your own function to format), but this would be a use case for the custom quantity formatters we've been discussing in #1357.

I'm unlikely to work on those myself, but I would review a PR (and help with refactoring the formatting code, since that's most likely necessary).

keewis avatar May 09 '23 09:05 keewis

I have this idea of moving all formating options to a "delegate" (basically using composition over inheritances for this type of things) Then, people would be able to hack they own formatters and plug them without changing the hierarchy. Ideas?

hgrecco avatar Jun 14 '23 19:06 hgrecco