This commit is contained in:
Anantha Kumaran 2024-01-03 20:26:14 +05:30
parent f4e82d8be2
commit 8236a09fbd
12 changed files with 192 additions and 27 deletions

2
docs/blog/index.md Normal file
View File

@ -0,0 +1,2 @@
# Blog

View File

@ -0,0 +1,60 @@
---
date: 2024-01-03
comments: true
categories:
- configuration
- locale
---
# Localization
The way numbers are formatted varies across various [countries](https://en.wikipedia.org/wiki/Decimal_separator#Examples_of_use). 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](../../reference/config.md),
and the Journal file localization is controlled by the commodity
directive.
<!-- more -->
## User Interface
### `locale`
The way the numbers are formatted by the User Interface is controlled
by the [configuration](../../reference/config.md) 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](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) and [country](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) 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.
## 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](https://ledger-cli.org/doc/ledger3.html#index-commodity-1) to declare the number
formatting. In the example below, we instruct the ledger to treat `,`
as decimal separator and `.` as thousand separator.
```ledger
commodity EUR
format 1.000,00 EUR
2024/01/01 Salary
Income:Salary:Acme -11.000,00 EUR
Assets:Checking 11.000,00 EUR
```

View File

@ -174,6 +174,6 @@ Paisa CLI is available as a nix flake.
an app that doesn't generate any income. Unfortunately, as a
result, you would have to jump through hoops to get it working.
[^2]: As the name implies, these are 3rd party hosting solutions
[^2]: As the name implies, these are third party hosting solutions
operated by independent companies. I may receive affiliate
compensation for linking to their websites.

View File

@ -19,11 +19,11 @@ convention.
There are five types of account namely
1. :fontawesome-solid-sack-dollar: Assets
1. :fontawesome-solid-credit-card: Liabilities
1. :fontawesome-solid-building: Income
1. :fontawesome-solid-wallet: Expenses
1. :fontawesome-solid-money-check-dollar: Equity
1. :fontawesome-solid-sack-dollar:{ .assets-color } Assets
1. :fontawesome-solid-credit-card:{ .liabilities-color } Liabilities
1. :fontawesome-solid-building:{ .income-color } Income
1. :fontawesome-solid-wallet:{ .expenses-color } Expenses
1. :fontawesome-solid-money-check-dollar:{ .equity-color } Equity
All the accounts you create should be under one of these
accounts. This naming convention is a necessity, because without

View File

@ -98,7 +98,7 @@ right next to period metadata.
```
┌─────────── day of the month 1-31
│ ┌─────────── month 1-12
│ ┌─────────── month 1-12 or JAN-DEC
│ │ ┌─────────── day of the week 0-6 (Sunday to Saturday)
│ │ │
1 * ?
@ -135,9 +135,9 @@ valid and the next 3 schedules if valid.
!!! tip
!!! warning
Recurring page will only show a transaction as recurring if there
Recurring page will only display a transaction as recurring if there
is more than **one transaction** with the same tag name. If you
have only one transaction, wait untill the next transaction is added
to see it on the recurring page.

View File

@ -127,3 +127,23 @@
.app-frame::after {
font-family: inherit;
}
.assets-color {
color: #00b0ff;
}
.expenses-color {
color: #ff1744;
}
.liabilities-color {
color: #ffab00;
}
.equity-color {
color: #d500f9;
}
.income-color {
color: #aeea00;
}

View File

@ -17,13 +17,29 @@
"type": "indirect"
}
},
"nixpkgs": {
"mkdocs-pkgs": {
"locked": {
"lastModified": 1701693815,
"narHash": "sha256-7BkrXykVWfkn6+c1EhFA3ko4MLi3gVG0p9G96PNnKTM=",
"lastModified": 1704196875,
"narHash": "sha256-AhEXx3uu32cnIOjIR3B2NMzqzwXfJYNPgVNfHQGYKzs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "09ec6a0881e1a36c29d67497693a67a16f4da573",
"rev": "0c6502e9830a7bf25258731316dd3c72fb08f94c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "staging-next",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1704008649,
"narHash": "sha256-rGPSWjXTXTurQN9beuHdyJhB8O761w1Zc5BqSSmHvoM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d44d59d2b5bd694cd9d996fd8c51d03e3e9ba7f7",
"type": "github"
},
"original": {
@ -34,6 +50,7 @@
"root": {
"inputs": {
"flake-utils": "flake-utils",
"mkdocs-pkgs": "mkdocs-pkgs",
"nixpkgs": "nixpkgs"
}
},

View File

@ -1,14 +1,20 @@
{
description = "paisa";
outputs = { self, nixpkgs, flake-utils }:
inputs.mkdocs-pkgs.url = "github:NixOS/nixpkgs/staging-next";
outputs = { self, nixpkgs, flake-utils, mkdocs-pkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
mkdocs = mkdocs-pkgs.legacyPackages.${system};
nodeDependencies = (pkgs.callPackage ./flake/override.nix {
nodejs = pkgs.nodejs-18_x;
}).nodeDependencies;
in {
devShells.default = import ./shell.nix { inherit pkgs; };
devShells.default = import ./shell.nix {
inherit pkgs;
inherit mkdocs;
};
packages.default = pkgs.buildGoModule {
pname = "paisa-cli";

View File

@ -35,7 +35,8 @@ nav:
- reference/changelog.md
- 'Demo': 'https://demo.paisa.fyi'
- faq.md
- Blog:
- blog/index.md
theme:
custom_dir: overrides
name: material
@ -45,16 +46,18 @@ theme:
repo: fontawesome/brands/github
palette:
- scheme: default
primary: indigo
media: "(prefers-color-scheme: light)"
primary: white
accent: indigo
toggle:
icon: material/brightness-7
icon: material/white-balance-sunny
name: Switch to dark mode
- scheme: slate
primary: indigo
media: "(prefers-color-scheme: dark)"
primary: black
accent: indigo
toggle:
icon: material/brightness-4
icon: material/moon-waning-crescent
name: Switch to light mode
features:
- content.tabs.link
@ -70,6 +73,8 @@ theme:
- search.highlight
markdown_extensions:
- toc:
permalink: true
- pymdownx.keys
- footnotes
- pymdownx.tabbed:
@ -90,8 +95,8 @@ markdown_extensions:
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
options:
custom_icons:
- overrides/.icons
@ -152,6 +157,6 @@ extra:
plugins:
- search
- blog
hooks:
- docs/lexer/hook.py

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 24 24"><g><g><g transform="rotate(360, 12, 12)"><path d="M12 12Z" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round"></path></g></g><g><g transform="rotate(0, 12, 12)"><path d="M 21.510565162951536 8.909830056250526 A 10 10 0 0 0 12 6" fill="none" stroke="currentColor" stroke-width="4"></path></g><g transform="rotate(72, 12, 12)"><path d="M 21.510565162951536 8.909830056250526 A 10 10 0 0 0 12 6" fill="none" stroke="currentColor" stroke-width="4"></path></g><g transform="rotate(144, 12, 12)"><path d="M 21.510565162951536 8.909830056250526 A 10 10 0 0 0 12 6" fill="none" stroke="currentColor" stroke-width="4"></path></g><g transform="rotate(216, 12, 12)"><path d="M 21.510565162951536 8.909830056250526 A 10 10 0 0 0 12 6" fill="none" stroke="currentColor" stroke-width="4"></path></g><g transform="rotate(288, 12, 12)"><path d="M 21.510565162951536 8.909830056250526 A 10 10 0 0 0 12 6" fill="none" stroke="currentColor" stroke-width="4"></path></g><g transform="rotate(72, 12, 12)"><path d="M12.59 5.88Z" fill="none" stroke="currentColor" stroke-width="4.2" stroke-linecap="round"></path></g><g transform="rotate(144, 12, 12)"><path d="M12.59 5.88Z" fill="none" stroke="currentColor" stroke-width="4.2" stroke-linecap="round"></path></g><g transform="rotate(216, 12, 12)"><path d="M12.59 5.88Z" fill="none" stroke="currentColor" stroke-width="4.2" stroke-linecap="round"></path></g><g transform="rotate(288, 12, 12)"><path d="M12.59 5.88Z" fill="none" stroke="currentColor" stroke-width="4.2" stroke-linecap="round"></path></g><g transform="rotate(360, 12, 12)"><path d="M12.59 5.88Z" fill="none" stroke="currentColor" stroke-width="4.2" stroke-linecap="round"></path></g></g></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 24 24"><g><g><g transform="rotate(360, 12, 12)"><path d="M12 12Z" fill="none" stroke="#b388ff" stroke-width="4" stroke-linecap="round"></path></g></g><g><g transform="rotate(0, 12, 12)"><path d="M 21.510565162951536 8.909830056250526 A 10 10 0 0 0 12 6" fill="none" stroke="#aeea00" stroke-width="4"></path></g><g transform="rotate(72, 12, 12)"><path d="M 21.510565162951536 8.909830056250526 A 10 10 0 0 0 12 6" fill="none" stroke="#ff1744" stroke-width="4"></path></g><g transform="rotate(144, 12, 12)"><path d="M 21.510565162951536 8.909830056250526 A 10 10 0 0 0 12 6" fill="none" stroke="#d500f9" stroke-width="4"></path></g><g transform="rotate(216, 12, 12)"><path d="M 21.510565162951536 8.909830056250526 A 10 10 0 0 0 12 6" fill="none" stroke="#ffab00" stroke-width="4"></path></g><g transform="rotate(288, 12, 12)"><path d="M 21.510565162951536 8.909830056250526 A 10 10 0 0 0 12 6" fill="none" stroke="#00b0ff" stroke-width="4"></path></g><g transform="rotate(72, 12, 12)"><path d="M12.59 5.88Z" fill="none" stroke="#aeea00" stroke-width="4.2" stroke-linecap="round"></path></g><g transform="rotate(144, 12, 12)"><path d="M12.59 5.88Z" fill="none" stroke="#ff1744" stroke-width="4.2" stroke-linecap="round"></path></g><g transform="rotate(216, 12, 12)"><path d="M12.59 5.88Z" fill="none" stroke="#d500f9" stroke-width="4.2" stroke-linecap="round"></path></g><g transform="rotate(288, 12, 12)"><path d="M12.59 5.88Z" fill="none" stroke="#ffab00" stroke-width="4.2" stroke-linecap="round"></path></g><g transform="rotate(360, 12, 12)"><path d="M12.59 5.88Z" fill="none" stroke="#00b0ff" stroke-width="4.2" stroke-linecap="round"></path></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,56 @@
{% if page.meta.comments %}
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
<!-- Insert generated snippet here -->
<script src="https://giscus.app/client.js"
data-repo="ananthakumaran/paisa"
data-repo-id="R_kgDOHEZoPQ"
data-category="Announcements"
data-category-id="DIC_kwDOHEZoPc4COrHF"
data-mapping="pathname"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="preferred_color_scheme"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous"
async>
</script>
<!-- Synchronize Giscus theme with palette -->
<script>
var giscus = document.querySelector("script[src*=giscus]")
// Set palette on initial load
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate"
? "transparent_dark"
: "light"
// Instruct Giscus to set theme
giscus.setAttribute("data-theme", theme)
}
// Register event handlers after documented loaded
document.addEventListener("DOMContentLoaded", function() {
var ref = document.querySelector("[data-md-component=palette]")
ref.addEventListener("change", function() {
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate"
? "transparent_dark"
: "light"
// Instruct Giscus to change theme
var frame = document.querySelector(".giscus-frame")
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme } } },
"https://giscus.app"
)
}
})
})
</script>
{% endif %}

View File

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> { } }:
{ pkgs ? import <nixpkgs> { }, mkdocs ? import <nixpkgs> { } }:
pkgs.mkShell {
nativeBuildInputs = [
@ -12,8 +12,7 @@ pkgs.mkShell {
pkgs.node2nix
# pkgs.pkgsCross.mingwW64.buildPackages.gcc
pkgs.python311Packages.mkdocs
pkgs.python311Packages.mkdocs-material
mkdocs.python311Packages.mkdocs-material
pkgs.python311Packages.beancount
# test