From b4ee527ed57c45e46bc9eaa2270591f07c1d3ecd Mon Sep 17 00:00:00 2001 From: Adrien CLERC Date: Sat, 2 May 2020 22:16:33 +0200 Subject: [PATCH] better i18n for "how much" column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #600 It also removes the "Amount in …" column by adding information as a tooltip if necessary --- ihatemoney/templates/list_bills.html | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/ihatemoney/templates/list_bills.html b/ihatemoney/templates/list_bills.html index 2369477d..88da9973 100644 --- a/ihatemoney/templates/list_bills.html +++ b/ihatemoney/templates/list_bills.html @@ -1,5 +1,10 @@ {% extends "sidebar_table_layout.html" %} +{%- macro bill_amount(bill, currency=bill.original_currency, amount=bill.amount) %} + {# Undocumented currencyformat filter from flask_babel is forwarding to Babel format_currency #} + {{ amount|currencyformat(currency if currency != 'XXX' else '') }} ({{ _("%(amount)s each", amount=bill.pay_each_default(amount)|currencyformat(currency if currency != 'XXX' else '')) }}) +{% endmacro -%} + {% block title %} - {{ g.project.name }}{% endblock %} {% block js %} {% if add_bill %} $('#new-bill > a').click(); {% endif %} @@ -117,11 +122,6 @@ {{ _("For what?") }} {{ _("For whom?") }} {{ _("How much?") }} - {% if g.project.default_currency != "XXX" %} - {{ _("Amount in %(currency)s", currency=g.project.default_currency) }} - {%- else -%} - {{ _("Amount") }} - {% endif %} {{ _("Actions") }} @@ -143,13 +143,11 @@ {{ bill.owers|join(', ', 'name') }} {%- endif %} - {% if bill.original_currency != "XXX" %} - {{ "%0.2f"|format(bill.amount) }} {{bill.original_currency}} ({{ "%0.2f"|format(bill.pay_each_default(bill.amount)) }} {{bill.original_currency}} {{ _(" each") }}) - {%- else -%} - {{ "%0.2f"|format(bill.amount) }} ({{ "%0.2f"|format(bill.pay_each_default(bill.amount)) }} {{ _(" each") }}) - {% endif %} + + {{ bill_amount(bill) }} + - {{ "%0.2f"|format(bill.converted_amount) }} {{ _('edit') }} {{ _('delete') }}