Skip to content

Commit

Permalink
[accounts] Marked all user-facing strings for translation
Browse files Browse the repository at this point in the history
Refs #1648
  • Loading branch information
marksweb authored Oct 25, 2024
1 parent ca192a1 commit a03e6fa
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
5 changes: 3 additions & 2 deletions accounts/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django import forms
from django.utils.translation import gettext_lazy as _

from .models import Profile

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

name = forms.CharField(
required=False, widget=forms.TextInput(attrs={"placeholder": "Name"})
required=False, widget=forms.TextInput(attrs={"placeholder": _("Name")})
)
email = forms.EmailField(
required=False, widget=forms.TextInput(attrs={"placeholder": "Email"})
required=False, widget=forms.TextInput(attrs={"placeholder": _("Email")})
)

class Meta:
Expand Down
27 changes: 15 additions & 12 deletions djangoproject/templates/accounts/edit_profile.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{% extends "registration/base.html" %}
{% load i18n %}

{% block title %}Edit your profile{% endblock %}
{% block title %}{% translate "Edit your profile" %}{% endblock %}

{% block content %}

{% if form.errors %}
<p class="errors">Please correct the errors below: {{ form.non_field_errors }}</p>
<p class="errors">{% translate "Please correct the errors below:" %} {{ form.non_field_errors }}</p>
{% endif %}

<h1>Edit your profile</h1>
<h1>{% translate "Edit your profile" %}</h1>

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

<div class="submit">
<input class="cta" type="submit" value="Save"/>
<input class="cta" type="submit" value="{% translate "Save" %}"/>
</div>
</form>
{% endblock %}

{% block content-related %}
<h1 class="visuallyhidden">Additional Information</h1>
<h1 class="visuallyhidden">{% translate "Additional Information" %}</h1>
<div role="complementary">
<h2>Help</h2>
<h2>{% translate "Help" %}</h2>

<p>Use this form to edit your profile.</p>
<p>{% translate "Use this form to edit your profile." %}</p>

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

<p>We hate spam as much as you do. We'll only use it to send you password reset
<p>{% blocktranslate trimmed %}
We hate spam as much as you do. We'll only use it to send you password reset
emails. We'll also use this email to try to fetch a <a
href="https://en.gravatar.com/">Gravatar</a>. You can change the image for this
email at <a href="https://en.gravatar.com/">Gravatar</a>.</p>
email at <a href="https://en.gravatar.com/">Gravatar</a>.{% endblocktranslate %}</p>
</div>
{% endblock %}
26 changes: 13 additions & 13 deletions djangoproject/templates/accounts/user_profile.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
{% extends "base_community.html" %}
{% load humanize %}
{% load humanize i18n %}

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

{% block content-related %}
<h1 class="visuallyhidden">Additional Information</h1>
<h1 class="visuallyhidden">{% translate "Additional Information" %}</h1>
<div role="complementary">
<h2>
{% if user_obj == user %}
This is you!
{% translate "This is you!" %}
{% else %}
Is this you?
{% translate "Is this you?" %}
{% endif %}
</h2>

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

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

Expand All @@ -43,7 +43,7 @@ <h1>
</h1>

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

{% with user_obj.owned_feeds.all as feeds %}
{% if feeds %}
<h2>Community feeds:</h2>
<h2>{% translate "Community feeds:" %}</h2>
<ul>
{% for f in feeds %}
<li><a href="{{ f.public_url }}">{{ f.title }}</a></li>
Expand Down

0 comments on commit a03e6fa

Please sign in to comment.