Add support for the accounting formatter style (negative amounts in parenthesis)
jarreds opened this issue · comments
Jarred Ward commented
Eg ($1.00) == -$1.00
Bojan Zivanovic commented
What is the use case/context in which you would use the parenthesis format?
Jarred Ward commented
Bojan Zivanovic commented
That's a valid use case, and one worth supporting.
Implementation notes:
- We need to add an accountingPattern to the currencyFormat struct
- We need to parse the "accounting" pattern in readFormat() in gen.go
- We should omit the accounting pattern if it's the same as the standard one, and have the formatter know how to fallback.
- The Formatter needs a Style field which can be "standard" or "accounting" and which influences which pattern is picked by getPattern(). We want to introduce an enum type for the Style like we did for RoundingMode and Display, but currency.Style is not distinctive enough. Perhaps FormatterStyle?
We'll want to do the CLDR v44 update first, it looks like it has relevant fixes (for the accounting patterns in various locales, such as the ones inheriting from es-419)
Bojan Zivanovic commented
@jarreds I have a PR up now, please test and provide feedback.