diff options
author | MS <ms@taler.net> | 2020-10-20 11:27:16 +0200 |
---|---|---|
committer | MS <ms@taler.net> | 2020-10-20 11:53:26 +0200 |
commit | 7a3d3b3130e2d1e56d2236c7c82d33b3e461b31d (patch) | |
tree | b3128c7c1bf7e0e1b763aa3c8fc48efad3ab8bc1 | |
parent | 4c3698cf4727403932f4225aa54fb9aeb7e0a6fe (diff) | |
download | bank-7a3d3b3130e2d1e56d2236c7c82d33b3e461b31d.tar.gz bank-7a3d3b3130e2d1e56d2236c7c82d33b3e461b31d.tar.bz2 bank-7a3d3b3130e2d1e56d2236c7c82d33b3e461b31d.zip |
more gettext() wrapping
-rw-r--r-- | talerbank/app/templates/login.html | 29 | ||||
-rw-r--r-- | talerbank/jinja2.py | 4 |
2 files changed, 19 insertions, 14 deletions
diff --git a/talerbank/app/templates/login.html b/talerbank/app/templates/login.html index c208990..04b792d 100644 --- a/talerbank/app/templates/login.html +++ b/talerbank/app/templates/login.html @@ -19,7 +19,7 @@ #} {% block headermsg %} - <h1 class="nav">Welcome to the {{ settings_value("TALER_CURRENCY") }} Bank!</h1> + <h1 class="nav"> {{ _("Welcome to the {currency} Bank!").format(currency=settings_value("TALER_CURRENCY")) }}</h1> {% endblock headermsg %} {% block content %} @@ -29,15 +29,19 @@ <h2>{{ _("Please login!") }}</h2> {% if form.errors %} - <p class="informational informational-fail">Your username and password didn't match. Please try again.</p> + <p class="informational informational-fail"> + {{ _("Your username and password didn't match. Please try again.") }} + </p> {% endif %} {% if next and next != url('profile') %} {% if request.user and request.user.is_authenticated %} - <p class="informational informational-fail">Your account doesn't have access to this page. To proceed, - please login with an account that has access.</p> + <p class="informational informational-fail"> + {{ _("Your account doesn't have access to this page. To proceed, please login with an account that has access.") }}</p> {% else %} - <p class="informational informational-fail">Please login to see this page.</p> + <p class="informational informational-fail"> + {{ _("Please login to see this page.") }} + </p> {% endif %} {% endif %} @@ -51,16 +55,17 @@ </div> {% if settings_value("ALLOW_REGISTRATIONS") %} <p> - If you are a new customer, please <a href="{{ url('register') }}">register</a>. - Registration is fast and free, and it gives you a registration bonus - of 100 {{ settings_value("TALER_CURRENCY") }}! - </p> + {% autoescape off %} + {{ _("If you are a new customer please <a href=\"{register_link}\">register</a>. Registration is fast and free, and it gives you a registration bonus of 100 {currency}").format(register_link=url('register'), currency=settings_value("TALER_CURRENCY")) }} + {% endautoescape %} + </p> {% else %} - <p>Registrations are not open to the public.</p> + <p>{{ _("Registrations are not open to the public.") }}</p> {% endif %} <p> - To view transactions of public accounts, - please <a href="{{ url('public-accounts') }}">click here</a>. + {% autoescape off %} + {{ _("To view transactions of public accounts, please <a href=\"{public_accoutns}\">click here</a>.").format(public_accounts=url('public-accounts')) }} + {% endautoescape %} </p> </article> </section> diff --git a/talerbank/jinja2.py b/talerbank/jinja2.py index 0f18f74..9b8d59b 100644 --- a/talerbank/jinja2.py +++ b/talerbank/jinja2.py @@ -26,7 +26,7 @@ from urllib.parse import urlparse from django.urls import reverse, get_script_prefix from django.conf import settings from jinja2 import Environment -from django.utils.translation import ugettext +from django.utils.translation import gettext ## # Check if a URL is absolute or not. @@ -140,7 +140,7 @@ def environment(**options): "is_valid_amount": is_valid_amount, "amount_stringify": amount_stringify, "tojson": tojson, - "_": ugettext, + "_": gettext, } ) return env |