Skip to content

Commit a03e6fa

Browse files
authored
[accounts] Marked all user-facing strings for translation
Refs #1648
1 parent ca192a1 commit a03e6fa

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

accounts/forms.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django import forms
2+
from django.utils.translation import gettext_lazy as _
23

34
from .models import Profile
45

@@ -12,10 +13,10 @@ class ProfileForm(forms.ModelForm):
1213
"""
1314

1415
name = forms.CharField(
15-
required=False, widget=forms.TextInput(attrs={"placeholder": "Name"})
16+
required=False, widget=forms.TextInput(attrs={"placeholder": _("Name")})
1617
)
1718
email = forms.EmailField(
18-
required=False, widget=forms.TextInput(attrs={"placeholder": "Email"})
19+
required=False, widget=forms.TextInput(attrs={"placeholder": _("Email")})
1920
)
2021

2122
class Meta:
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{% extends "registration/base.html" %}
2+
{% load i18n %}
23

3-
{% block title %}Edit your profile{% endblock %}
4+
{% block title %}{% translate "Edit your profile" %}{% endblock %}
45

56
{% block content %}
67

78
{% if form.errors %}
8-
<p class="errors">Please correct the errors below: {{ form.non_field_errors }}</p>
9+
<p class="errors">{% translate "Please correct the errors below:" %} {{ form.non_field_errors }}</p>
910
{% endif %}
1011

11-
<h1>Edit your profile</h1>
12+
<h1>{% translate "Edit your profile" %}</h1>
1213

1314
<form method="post" action="" class="form-input">
1415
{% csrf_token %}
@@ -27,25 +28,27 @@ <h1>Edit your profile</h1>
2728
</div>
2829

2930
<div class="submit">
30-
<input class="cta" type="submit" value="Save"/>
31+
<input class="cta" type="submit" value="{% translate "Save" %}"/>
3132
</div>
3233
</form>
3334
{% endblock %}
3435

3536
{% block content-related %}
36-
<h1 class="visuallyhidden">Additional Information</h1>
37+
<h1 class="visuallyhidden">{% translate "Additional Information" %}</h1>
3738
<div role="complementary">
38-
<h2>Help</h2>
39+
<h2>{% translate "Help" %}</h2>
3940

40-
<p>Use this form to edit your profile.</p>
41+
<p>{% translate "Use this form to edit your profile." %}</p>
4142

42-
<p>Use whatever name you'd like to be identified with on djangoproject.com. If
43-
you leave it blank, we'll identify you as <b>{{ user.username }}</b>, your
44-
username.</p>
43+
<p>{% blocktranslate trimmed with username=user.username %}
44+
Use whatever name you'd like to be identified with on djangoproject.com. If
45+
you leave it blank, we'll identify you as <b>{{ username }}</b>, your
46+
username.{% endblocktranslate %}</p>
4547

46-
<p>We hate spam as much as you do. We'll only use it to send you password reset
48+
<p>{% blocktranslate trimmed %}
49+
We hate spam as much as you do. We'll only use it to send you password reset
4750
emails. We'll also use this email to try to fetch a <a
4851
href="https://en.gravatar.com/">Gravatar</a>. You can change the image for this
49-
email at <a href="https://en.gravatar.com/">Gravatar</a>.</p>
52+
email at <a href="https://en.gravatar.com/">Gravatar</a>.{% endblocktranslate %}</p>
5053
</div>
5154
{% endblock %}

djangoproject/templates/accounts/user_profile.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
{% extends "base_community.html" %}
2-
{% load humanize %}
2+
{% load humanize i18n %}
33

44
{% block title %}{% firstof user_obj.profile.name user_obj.username %}{% endblock %}
55

66
{% block content-related %}
7-
<h1 class="visuallyhidden">Additional Information</h1>
7+
<h1 class="visuallyhidden">{% translate "Additional Information" %}</h1>
88
<div role="complementary">
99
<h2>
1010
{% if user_obj == user %}
11-
This is you!
11+
{% translate "This is you!" %}
1212
{% else %}
13-
Is this you?
13+
{% translate "Is this you?" %}
1414
{% endif %}
1515
</h2>
1616

17-
<p>Need to edit something? Here's how:</p>
17+
<p>{% translate "Need to edit something? Here's how:" %}</p>
1818
<ul>
19-
<li><a href="{% url 'edit_profile' %}">Edit your name and email here.</a></li>
20-
<li>
19+
<li><a href="{% url 'edit_profile' %}">{% translate "Edit your name and email here." %}</a></li>
20+
<li>{% blocktranslate trimmed %}
2121
The image is the <a href="https://en.gravatar.com/">Gravatar</a> linked
2222
to the email address you signed up with. You can change the image over
2323
at <a href="https://en.gravatar.com/">Gravatar</a>. If you see a robot, that's
2424
because you don't have a Gravatar yet.
25-
(Robots provided by <a href="https://robohash.org/">Robohash</a>.)
25+
(Robots provided by <a href="https://robohash.org/">Robohash</a>.){% endblocktranslate %}
2626
</li>
27-
<li>
27+
<li>{% blocktranslate trimmed %}
2828
The rest of the data is read-only for the time being. If you see
2929
outrageous errors, please file an issue on
30-
<a href="https://github.com/django/code.djangoproject.com/issues/new" target="_blank">GitHub</a>.
30+
<a href="https://github.com/django/code.djangoproject.com/issues/new" target="_blank">GitHub</a>.{% endblocktranslate %}
3131
</li>
3232
</ul>
3333
</div>
3434
{% endblock %}
3535

3636
{% block content %}
37-
<div class ="user-info">
37+
<div class="user-info">
3838
<img class='avatar' width='150' height='150'
3939
src="https://secure.gravatar.com/avatar/{{ email_hash }}?s=150&amp;d=https%3A%2F%2Frobohash.org%2F{{ email_hash }}%3Fset%3Dset3%26size%3D150x150">
4040

@@ -43,7 +43,7 @@ <h1>
4343
</h1>
4444

4545
{% if stats %}
46-
<h2>Lies, damned lies, and statistics:</h2>
46+
<h2>{% translate "Lies, damned lies, and statistics:" %}</h2>
4747
<ul>
4848
{% for stat, value in stats.items %}
4949
<li>{{ stat }}: {{ value|intcomma }}.</li>
@@ -53,7 +53,7 @@ <h2>Lies, damned lies, and statistics:</h2>
5353

5454
{% with user_obj.owned_feeds.all as feeds %}
5555
{% if feeds %}
56-
<h2>Community feeds:</h2>
56+
<h2>{% translate "Community feeds:" %}</h2>
5757
<ul>
5858
{% for f in feeds %}
5959
<li><a href="{{ f.public_url }}">{{ f.title }}</a></li>

0 commit comments

Comments
 (0)