Localization¶
The way numbers are formatted varies across various countries. In this post, I am going to talk about how to configure localization in Paisa so you can use the number formatting you are familiar with.
The User Interface localization is controlled by configuration, and the Journal file localization is controlled by the commodity directive.
User Interface¶
locale¶
The way the numbers are formatted by the User Interface is controlled by the
configuration key called locale. By default, this
value is set to en-IN. It can be edited via the configuration page. The value
is made of two parts: the first part is the language name, and the second part
is the region name. Refer to Wikipedia for the full list of supported
language and
country codes.
default_currency¶
Paisa supports multiple currencies, but it needs you to set one of the currencies as the default currency. The User Interface shows all the numbers in the default currency.
display_precision¶
Paisa also allows you to control the number of digits shown after the decimal point. By default, it's set to zero.
time_zone¶
Paisa by default will try to use the system time zone. But if you deploy the application in a server, then you would have to set the time zone explicitly, as the server time zone might not be same as your local time zone. The time zone is used to parse and format dates.
Journal¶
In most cases, you don't have to worry about the journal file since you can
enter the value in the correct format and the ledger will parse it fine. But if
you want to follow European number formatting, then you would have to use
commodity directive
to declare the number formatting. In the example below, we instruct the ledger
to treat , as decimal separator and . as thousand separator.