diff options
author | metamuffin <metamuffin@disroot.org> | 2024-11-06 20:48:09 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-11-06 20:48:09 +0100 |
commit | f5a045dc96b3ff500047dc20d7180c1ec7cbe1da (patch) | |
tree | baaee3dd563f4be7b3349fef4ef7c473f47bfb82 | |
parent | fdc4036187351f0b2ea0f1ce0657976769e5d513 (diff) | |
download | abrechenbarkeit-f5a045dc96b3ff500047dc20d7180c1ec7cbe1da.tar abrechenbarkeit-f5a045dc96b3ff500047dc20d7180c1ec7cbe1da.tar.bz2 abrechenbarkeit-f5a045dc96b3ff500047dc20d7180c1ec7cbe1da.tar.zst |
thing
-rwxr-xr-x | abrechenbarkeit.lua | 11 | ||||
-rw-r--r-- | locale/en.ini | 1 |
2 files changed, 6 insertions, 6 deletions
diff --git a/abrechenbarkeit.lua b/abrechenbarkeit.lua index 349994f..26fcfac 100755 --- a/abrechenbarkeit.lua +++ b/abrechenbarkeit.lua @@ -127,12 +127,11 @@ local function format(template, params) end local function format_amount(amount, tag, classes) - -- local s = format("{+price.amount}", { - -- sign = amount > 0 and "{+price.sign.pos}" or "{+price.sign.neg}", - -- amount = string.format("%.2f", math.abs(amount / 100)), - -- unit = config.unit or "€" - -- }) - local s = string.format("%s%.02f%s", amount > 0 and "+" or "", amount / 100, config.unit or "€") + local s = format("{+price.amount}", { + sign = amount >= 0 and "+" or "-", + amount = string.format("%.2f", math.abs(amount / 100)), + unit = config.unit or "€" + }) if tag == nil then return s end return format( [[<{tag} class="amount-{sign} {classes}">{content}</{tag}>]], { diff --git a/locale/en.ini b/locale/en.ini index 3171b9b..6179a60 100644 --- a/locale/en.ini +++ b/locale/en.ini @@ -46,3 +46,4 @@ user.form.transaction=Create Transaction user.last_txn=Last transaction added {time}. user.lazy_creation=This user account does not exist yet. It will only be created after the first transaction. user.view_log=View user log +price.amount={sign}{amount}{unit} |