Skip to content

Commit 910e7c8

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

File tree

9 files changed

+51
-33
lines changed

9 files changed

+51
-33
lines changed

blog/feeds.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
from django.contrib.syndication.views import Feed
2+
from django.utils.translation import gettext_lazy as _
23

34
from .models import Entry
45

56

67
class WeblogEntryFeed(Feed):
7-
title = "The Django weblog"
8+
title = _("The Django weblog")
89
link = "https://www.djangoproject.com/weblog/"
9-
description = "Latest news about Django, the Python web framework."
10+
description = _("Latest news about Django, the Python web framework.")
1011

1112
def items(self):
1213
return Entry.objects.published()[:10]
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
{% extends "base.html" %}
2-
{% load weblog fundraising_extras %}
2+
{% load fundraising_extras i18n weblog %}
33
{% block layout_class %}sidebar-right{% endblock %}
4-
{% block title %}News & Events{% endblock %}
4+
{% block title %}{% translate "News & Events" %}{% endblock %}
55

6-
{% block og_title %}News & Events{% endblock %}
6+
{% block og_title %}{% translate "News & Events" %}{% endblock %}
77

88
{% block header %}
9-
<h1><a href="{% url 'weblog:index' %}">News &amp; Events</a></h1>
9+
<h1><a href="{% url 'weblog:index' %}">{% translate "News &amp; Events" %}</a></h1>
1010
{% endblock %}
1111

1212
{% block head_extra %}
1313
<link rel="alternate" type="application/rss+xml" title="RSS" href="{% url 'weblog-feed' %}" />
1414
{% endblock %}
1515

1616
{% block content-related %}
17-
<h1 class="visuallyhidden">Additional Information</h1>
17+
<h1 class="visuallyhidden">{% translate "Additional Information" %}</h1>
1818
<div role="complementary">
1919
{% donation_snippet %}
2020

2121
{% if events %}
22-
<h2>Upcoming Events</h2>
22+
<h2>{% translate "Upcoming Events" %}</h2>
2323
<ul class="list-events">
2424
{% for event in events %}
2525
<li>
2626
<a href="{{ event.external_url }}" target="_blank">{{ event.headline }}</a>
27-
<span class="meta"><span>{{ event.date|date:"F j, Y" }}</span> | {{ event.location }}</span>
27+
<span class="meta"><span>{{ event.date|date:"DATE_FORMAT" }}</span> | {{ event.location }}</span>
2828
<i class="icon icon-calendar"></i>
2929
</li>
3030
{% endfor %}
3131
</ul>
3232
{% endif %}
33-
<p><a href="/foundation/conferences/">Want your event listed here?</a></p>
33+
<p><a href="/foundation/conferences/">{% translate "Want your event listed here?" %}</a></p>
3434

3535
{% comment %}
3636
{# tags not implemented in backend yet #}
@@ -44,13 +44,13 @@ <h2><span>Tags</span></h2>
4444
</ul>
4545
{% endcomment %}
4646

47-
<h2><span>Archives</span></h2>
47+
<h2><span>{% translate "Archives" %}</span></h2>
4848
{% render_month_links %}
4949

50-
<h2><span>RSS Feeds</span></h2>
50+
<h2><span>{% translate "RSS Feeds" %}</span></h2>
5151
<ul class="list-links-small rss-list">
52-
<li><a href="{% url 'weblog-feed' %}">Latest news entries</a></li>
53-
<li><a href="https://code.djangoproject.com/timeline?daysback=90&max=50&wiki=on&ticket=on&changeset=on&milestone=on&format=rss">Recent code changes</a></li>
52+
<li><a href="{% url 'weblog-feed' %}">{% translate "Latest news entries" %}</a></li>
53+
<li><a href="https://code.djangoproject.com/timeline?daysback=90&max=50&wiki=on&ticket=on&changeset=on&milestone=on&format=rss">{% translate "Recent code changes" %}</a></li>
5454
</ul>
5555
</div>
5656
{% endblock %}

djangoproject/templates/blog/blog_pagination.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1+
{% load i18n %}
2+
13
{% if is_paginated %}
24
<div class="pagination">
35
<ul class="nav-pagination" role="navigation">
46
{% if page_obj.has_previous %}
57
<li><a class="previous" href="?page={{ page_obj.previous_page_number }}">
68
<i class="icon icon-chevron-left"></i>
7-
<span class="visuallyhidden">Previous</span>
9+
<span class="visuallyhidden">{% translate "Previous" context "pagination" %}</span>
810
</a></li>
911
{% endif %}
1012
<span class="page-current">
11-
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
13+
{% blocktranslate trimmed with page_num=page_obj.number pages=page_obj.paginator.num_pages %}
14+
Page {{ page_num }} of {{ pages }}
15+
{% endblocktranslate %}
1216
</span>
1317
{% if page_obj.has_next %}
1418
<li><a class="next" href="?page={{ page_obj.next_page_number }}">
1519
<i class="icon icon-chevron-right"></i>
16-
<span class="visuallyhidden">Next</span>
20+
<span class="visuallyhidden">{% translate "Next" context "pagination" %}</span>
1721
</a></li>
1822
{% endif %}
1923
</ul>

djangoproject/templates/blog/entry_archive_day.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{% extends "base_weblog.html" %}
2+
{% load i18n %}
23

3-
{% block title %}{{ day|date:"F j" }} | Weblog{% endblock %}
4+
{% block title %}{{ day|date:"MONTH_DAY_FORMAT" }} | {% translate "Weblog" %}{% endblock %}
45

5-
{% block og_title %}Django news: {{ day|date:"F j" }} archive{% endblock %}
6+
{% block og_title %}{% blocktranslate %}Django news: {{ day|date:"MONTH_DAY_FORMAT" }} archive{% endblocktranslate %}{% endblock %}
67

78
{% block content %}
89

9-
<h1>{{ day|date:"F j" }} archive</h1>
10+
<h1>{% blocktranslate %}{{ day|date:"MONTH_DAY_FORMAT" }} archive{% endblocktranslate %}</h1>
1011

1112
<ul class="list-news">
1213

djangoproject/templates/blog/entry_archive_month.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{% extends "base_weblog.html" %}
2+
{% load i18n %}
23

3-
{% block title %}{{ month|date:"F" }} | Weblog{% endblock %}
4+
{% block title %}{{ month|date:"YEAR_MONTH_FORMAT" }} | {% translate "Weblog" %}{% endblock %}
45

5-
{% block og_title %}Django news: {{ month|date:"F Y" }} archive{% endblock %}
6+
{% block og_title %}{% blocktranslate %}Django news: {{ month|date:"YEAR_MONTH_FORMAT" }} archive{% endblocktranslate %}{% endblock %}
67

78
{% block content %}
89

9-
<h1>{{ month|date:"F Y" }} archive</h1>
10+
<h1>{% blocktranslate %}{{ month|date:"YEAR_MONTH_FORMAT" }} archive{% endblocktranslate %}</h1>
1011

1112
<ul class="list-news">
1213

djangoproject/templates/blog/entry_archive_year.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{% extends "base_weblog.html" %}
2+
{% load i18n %}
23

3-
{% block title %}{{ year|date:"Y" }} | Weblog{% endblock %}
4+
{% block title %}{{ year|date:"Y" }} | {% translate "Weblog" %}{% endblock %}
45

5-
{% block og_title %}Django news: {{ year|date:"Y" }} archive{% endblock %}
6+
{% block og_title %}{% blocktranslate with year=year|date:"Y" %}Django news: {{ year }} archive{% endblocktranslate %}{% endblock %}
67

78
{% block content %}
89

9-
<h1>{{ year|date:"Y" }} archive</h1>
10+
<h1>{{ year|date:"Y" }} {% translate "archive" %}</h1>
1011

1112
<ul class="list-news">
1213

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
{% extends "base_weblog.html" %}
2+
{% load i18n %}
23

34
{% block title %}{{ object.headline|escape }} | Weblog{% endblock %}
45

56
{% block og_title %}{{ object.headline|safe }}{% endblock %}
6-
{% block og_description %}Posted by {{ object.author }} on {{ object.pub_date|date:"F j, Y" }}{% endblock %}
7+
{% block og_description %}{% blocktranslate trimmed with author=object.author pub_date=object.pub_date|date:"DATE_FORMAT" %}
8+
Posted by {{ author }} on {{ pub_date }}
9+
{% endblocktranslate %}{% endblock %}
710

811
{% block content %}
912
<h2>{{ object.headline|safe }}</h2>
1013

11-
<span class="meta">Posted by <strong>{{ object.author }}</strong> on {{ object.pub_date|date:"F j, Y" }} {% comment %}in <a href="#">Release Announcements</a>{% endcomment %}</span>
12-
13-
{{ object.body_html|safe }}
14+
<span class="meta">{% blocktranslate trimmed with author=object.author pub_date=object.pub_date|date:"DATE_FORMAT" %}
15+
Posted by <strong>{{ author }}</strong> on {{ pub_date }} </span>
16+
{% endblocktranslate %}
17+
{{ object.body_html|safe }}
1418
{% endblock %}

djangoproject/templates/blog/month_links_snippet.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h2><a href="{% url 'weblog:archive-year' month.grouper %}">{{ month.grouper }}<
88
<div class="collapsing-content">
99
<ul class="list-links-small">
1010
{% for d in month.list %}
11-
<li><a href="{% language "en" %}{% url 'weblog:archive-month' d|date:"Y" d|date:"b" %}{% endlanguage %}">{{ d|date:"F Y" }}</a></li>
11+
<li><a href="{% language "en" %}{% url 'weblog:archive-month' d|date:"Y" d|date:"b" %}{% endlanguage %}">{{ d|date:"YEAR_MONTH_FORMAT" }}</a></li>
1212
{% endfor %}
1313
</ul>
1414
<p></p>
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{% load i18n %}
2+
13
<li{% if not object.is_published %} class="unpublished"{% endif %}>
24
<{{ header_tag|default:'h2' }}>
35
<a href="{{ object.get_absolute_url }}">{{ object.headline|safe }}</a>
@@ -6,12 +8,16 @@
68
{{ object.summary_html|safe }}
79
{% endif %}
810
<span class="meta">
9-
Posted by <strong>{{ object.author }}</strong> on {{ object.pub_date|date:"F j, Y" }}
11+
{% blocktranslate trimmed with author=object.author pub_date=object.pub_date|date:"DATE_FORMAT" %}
12+
Posted by <strong>{{ author }}</strong> on {{ pub_date }}
13+
{% endblocktranslate %}
1014
</span>
1115
{% if not summary_first %}
1216
{{ object.summary_html|safe }}
1317
{% endif %}
1418
{% if not hide_readmore %}
15-
<a class="link-readmore" href="{{ object.get_absolute_url }}">Read more</a>
19+
<a class="link-readmore" href="{{ object.get_absolute_url }}">
20+
{% translate "Read more" context "Following article summary" %}
21+
</a>
1622
{% endif %}
1723
</li>

0 commit comments

Comments
 (0)