Skip to content

Commit 8790d59

Browse files
authored
[contact] Marked all user-facing strings for translation
Refs #1648
1 parent 910e7c8 commit 8790d59

File tree

5 files changed

+56
-31
lines changed

5 files changed

+56
-31
lines changed

contact/forms.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from django.conf import settings
66
from django.contrib.sites.models import Site
77
from django.utils.encoding import force_bytes
8+
from django.utils.translation import gettext_lazy as _
89
from django_contact_form.forms import ContactForm
910
from django_recaptcha.fields import ReCaptchaField
1011
from django_recaptcha.widgets import ReCaptchaV3
@@ -17,19 +18,19 @@ class BaseContactForm(ContactForm):
1718
message_subject = forms.CharField(
1819
max_length=100,
1920
widget=forms.TextInput(
20-
attrs={"class": "required", "placeholder": "Message subject"}
21+
attrs={"class": "required", "placeholder": _("Message subject")}
2122
),
22-
label="Message subject",
23+
label=_("Message subject"),
2324
)
2425
email = forms.EmailField(
25-
widget=forms.TextInput(attrs={"class": "required", "placeholder": "E-mail"})
26+
widget=forms.TextInput(attrs={"class": "required", "placeholder": _("E-mail")})
2627
)
2728
name = forms.CharField(
28-
widget=forms.TextInput(attrs={"class": "required", "placeholder": "Name"})
29+
widget=forms.TextInput(attrs={"class": "required", "placeholder": _("Name")})
2930
)
3031
body = forms.CharField(
3132
widget=forms.Textarea(
32-
attrs={"class": "required", "placeholder": "Your message"}
33+
attrs={"class": "required", "placeholder": _("Your message")}
3334
)
3435
)
3536
captcha = ReCaptchaField(widget=ReCaptchaV3)
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{% extends "base_3col.html" %}
2+
{% load i18n %}
23

3-
{% block title %}Django Code of Conduct Feedback{% endblock %}
4+
{% block title %}{% translate "Django Code of Conduct Feedback" %}{% endblock %}
45

56
{% block content %}
6-
<h1>Django Code of Conduct Feedback</h1>
7+
<h1>{% translate "Django Code of Conduct Feedback" %}</h1>
78
{% include "contact/coc_form.html" %}
89
{% endblock %}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
{% load i18n %}
12
<form action="{% url "contact_coc" %}" method="post" accept-charset="utf-8" class="wide">
23
{% csrf_token %}
34

45
{# hardcoding inputs because they'll be included on the CoC page itself #}
56
<p>
6-
<label for="id_name">Your name (optional):</label>
7+
<label for="id_name">{% translate "Your name (optional):" %}</label>
78
{% if form.name.errors %}<p class="errors">{{ form.name.errors.as_text }}</p>{% endif %}
89
<input id="id_name" class="required" type="text" name="name">
910
</p>
1011
<p>
11-
<label for="id_email">Your email address (optional):</label>
12+
<label for="id_email">{% translate "Your email address (optional):" %}</label>
1213
{% if form.email.errors %}<p class="errors">{{ form.email.errors.as_text }}</p>{% endif %}
1314
<input id="id_email" class="required" type="text" name="email">
1415
</p>
1516
<p>
16-
<label for="id_body">Your message:</label>
17+
<label for="id_body">{% translate "Your message:" %}</label>
1718
{% if form.body.errors %}<p class="errors">{{ form.body.errors.as_text }}</p>{% endif %}
1819
<textarea id="id_body" class="required" rows="10" name="body" cols="40"></textarea>
1920
</p>
20-
<p class="submit"><input type="submit" value="Send &rarr;"></p>
21+
<p class="submit"><input type="submit" value="{% translate "Send &rarr;" %}"></p>
2122

2223
</form>

djangoproject/templates/contact/foundation.html

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
{% extends "base_foundation.html" %}
2+
{% load i18n %}
23

3-
{% block title %}Contact the Django Software Foundation{% endblock %}
4+
{% block title %}{% translate "Contact the Django Software Foundation" %}{% endblock %}
45

56
{% block content %}
6-
<h1>Contact the Django Software Foundation</h1>
7-
<p>This contact form is for the Django Software Foundation - the legal and
8-
fundraising arm of the Django project.</p>
9-
<p>If you want to report a bug, feature request, or documentation issue in Django,
10-
use the <a href="https://code.djangoproject.com">ticket tracker</a>.</p>
11-
<p>If you want to report a problem with this website, use the
12-
<a href="https://github.com/django/djangoproject.com">GitHub repo</a>.</p>
13-
<p>If you've got questions about how to use Django, use the
14-
<a href="https://groups.google.com/forum/#!forum/django-users">django-users mailing list</a>.</p>
7+
<h1>{% translate "Contact the Django Software Foundation" %}</h1>
8+
<p>
9+
{% blocktranslate trimmed %}
10+
This contact form is for the Django Software Foundation - the legal and
11+
fundraising arm of the Django project.
12+
{% endblocktranslate %}
13+
</p>
14+
<p>
15+
{% blocktranslate trimmed %}
16+
If you want to report a bug, feature request, or documentation issue in Django,
17+
use the <a href="https://code.djangoproject.com">ticket tracker</a>.
18+
{% endblocktranslate %}
19+
</p>
20+
<p>
21+
{% blocktranslate trimmed %}
22+
If you want to report a problem with this website, use the
23+
<a href="https://github.com/django/djangoproject.com">GitHub repo</a>.
24+
{% endblocktranslate %}
25+
</p>
26+
<p>
27+
{% blocktranslate trimmed %}
28+
If you've got questions about how to use Django, use the
29+
<a href="https://groups.google.com/forum/#!forum/django-users">django-users mailing list</a>.
30+
{% endblocktranslate %}
31+
</p>
1532
<form action="." method="post" accept-charset="utf-8" class="form-input">
1633
{% csrf_token %}
1734
<p>
@@ -31,6 +48,6 @@ <h1>Contact the Django Software Foundation</h1>
3148
{{ form.body }}
3249
</p>
3350
<p>{{ form.captcha }}</p>
34-
<p class="submit"><input type="submit" class="cta" value="Send &rarr;"></p>
51+
<p class="submit"><input type="submit" class="cta" value="{% translate "Send &rarr;" %}"></p>
3552
</form>
3653
{% endblock %}
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
{% extends "base_foundation.html" %}
2+
{% load i18n %}
23

3-
{% block title %}Message sent{% endblock %}
4+
{% block title %}{% translate "Message sent" %}{% endblock %}
45

56
{% block content %}
6-
<h1>Message sent</h1>
7-
<h2 class="deck">Your message has been sent; thanks!</h2>
7+
<h1>{% translate "Message sent" %}</h1>
8+
<h2 class="deck">{% translate "Your message has been sent; thanks!" %}</h2>
89
<p>
9-
Your mail <em>will</em> be read by a real, live human being. We can't
10-
guarantee when or whether you'll get a reply, but your message
11-
<em>will</em> be read, generally within the next couple of days.
10+
{% blocktranslate trimmed %}
11+
Your mail <em>will</em> be read by a real, live human being. We can't
12+
guarantee when or whether you'll get a reply, but your message
13+
<em>will</em> be read, generally within the next couple of days.
14+
{% endblocktranslate %}
1215
</p>
1316
<p>
14-
If you're expecting a reply and don't get one, please feel free
15-
to send a reminder. Please wait a few days, however, unless
16-
it's an emergency.
17+
{% blocktranslate trimmed %}
18+
If you're expecting a reply and don't get one, please feel free
19+
to send a reminder. Please wait a few days, however, unless
20+
it's an emergency.
21+
{% endblocktranslate %}
1722
</p>
1823
{% endblock %}

0 commit comments

Comments
 (0)