pint
pint copied to clipboard
Compact Currency Formatting
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?
I would love to know!
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).
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?