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}]], { 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}