i18n: Don't include email tags in translation strings.

This commit is contained in:
Vishnu KS 2020-09-16 23:00:05 +05:30 committed by Tim Abbott
parent 2d2ea9af6e
commit a888e65ea4
5 changed files with 15 additions and 6 deletions

View File

@ -11,7 +11,7 @@
<div class="app-main white-box">
{% trans %}
This confirms that the email address for your Zulip account has changed
from <a href="mailto:{{old_email}}">{{old_email}}</a> to <a href="mailto:{{new_email}}">{{new_email}}</a>.
from {{ old_email_html_tag }} to {{ new_email_html_tag }}
{% endtrans %}
</div>
</div>

View File

@ -9,7 +9,7 @@
<h1 class="lead">{{ _("Whoops. We couldn't find your confirmation link in the system.") }}</h1>
<p>
{% trans %}
Anyway, shoot us a line at <a href="mailto:{{ support_email }}">{{ support_email }}</a> and we'll get this resolved shortly.
Anyway, shoot us a line at {{ support_email_html_tag }} and we'll get this resolved shortly.
{% endtrans %}
</p>
</div>

View File

@ -10,7 +10,7 @@
<p>{{ _("Make sure you copied the link correctly in to your browser. If you're still encountering this page, it's probably our fault. We're sorry.") }}</p>
<p>
{% trans %}
Anyway, shoot us a line at <a href="mailto:{{ support_email }}">{{ support_email }}</a> and we'll get this resolved shortly.
Anyway, shoot us a line at {{ support_email_html_tag }} and we'll get this resolved shortly.
{% endtrans %}
</p>
</div>

View File

@ -3,6 +3,8 @@ from urllib.parse import urljoin
from django.conf import settings
from django.http import HttpRequest
from django.utils.html import escape
from django.utils.safestring import SafeString
from version import (
LATEST_MAJOR_VERSION,
@ -112,6 +114,9 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]:
settings_path = "/etc/zulip/settings.py"
settings_comments_path = "/etc/zulip/settings.py"
support_email = FromAddress.SUPPORT
support_email_html_tag = SafeString(f'<a href="mailto:{escape(support_email)}">{escape(support_email)}</a>')
# We can't use request.client here because we might not be using
# an auth decorator that sets it, but we can call its helper to
# get the same result.
@ -136,7 +141,8 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]:
'apps_page_web': apps_page_web,
'open_realm_creation': settings.OPEN_REALM_CREATION,
'development_environment': settings.DEVELOPMENT,
'support_email': FromAddress.SUPPORT,
'support_email': support_email,
'support_email_html_tag': support_email_html_tag,
'find_team_link_disabled': find_team_link_disabled,
'password_min_length': settings.PASSWORD_MIN_LENGTH,
'password_min_guesses': settings.PASSWORD_MIN_GUESSES,

View File

@ -5,6 +5,8 @@ from django.contrib.auth import authenticate, update_session_auth_hash
from django.core.exceptions import ValidationError
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.utils.html import escape
from django.utils.safestring import SafeString
from django.utils.translation import ugettext as _
from confirmation.models import (
@ -69,8 +71,9 @@ def confirm_email_change(request: HttpRequest, confirmation_key: str) -> HttpRes
realm=user_profile.realm)
ctx = {
'new_email': new_email,
'old_email': old_email,
'new_email_html_tag': SafeString(f'<a href="mailto:{escape(new_email)}">{escape(new_email)}</a>'),
'old_email_html_tag': SafeString(f'<a href="mailto:{escape(old_email)}">{escape(old_email)}</a>'),
}
return render(request, 'confirmation/confirm_email_change.html', context=ctx)