Support seperate locales for different commodities
Some currencies format their amounts differently from USD. It would like to format the amounts in each currency as they would in their country of origin. Taking the example from the docs, I want the number 1111111.33 to be rendered:
1,111,111.33with localeen_USfor USD11,11,111.33with localeen_INfor INR1.111.111,33with localedefor EUR.
As of right now the locale can be changed with the locale option for all commodities. I suggest that the locale option be kept as a default for all commodities, and a fava-locale option be introduced as an attribute of a currency:
option "render_commas" "True"
2025-06-13 custom "fava-option" "language" "en"
2025-06-13 custom "fava-option" "locale" "en"
1792-01-01 commodity USD
name: "US Dollar"
export: "CASH"
1867-07-01 commodity CAD
name: "Canadian Dollar"
export: "CASH"
1947-08-15 commodity INR
name: "Indian Rupee"
export: "CASH"
fava-locale: "en_IN"
So USD and CAD would have locale en while INR would have locale en_IN.
Alternatively, this issue should be transferred to beancount itself. Beancount only renders commas with the en locale and I would like these formatting rules to extend to text output from the CLI and reports that are generated.
Sure, why not :) Just one thing could be irritating when using this is that not all places where numbers are rendered (e.g. in queries), there's a known currency, so that could cause inconsistencies. I'd just call the metadata key locale though.
Cool. Will send a PR soon.
Just one thing could be irritating when using this is that not all places where numbers are rendered (e.g. in queries), there's a known currency, so that could cause inconsistencies
I think that's fine and expected.
I'd just call the metadata key locale though.
I thought you'd want to separate metadata to fava and core beancount. locale is fine with me.