Skip to content

Commit

Permalink
[blog] 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 Nov 17, 2024
1 parent 2495507 commit 910e7c8
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 33 deletions.
5 changes: 3 additions & 2 deletions blog/feeds.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from django.contrib.syndication.views import Feed
from django.utils.translation import gettext_lazy as _

from .models import Entry


class WeblogEntryFeed(Feed):
title = "The Django weblog"
title = _("The Django weblog")
link = "https://www.djangoproject.com/weblog/"
description = "Latest news about Django, the Python web framework."
description = _("Latest news about Django, the Python web framework.")

def items(self):
return Entry.objects.published()[:10]
Expand Down
24 changes: 12 additions & 12 deletions djangoproject/templates/base_weblog.html
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{% extends "base.html" %}
{% load weblog fundraising_extras %}
{% load fundraising_extras i18n weblog %}
{% block layout_class %}sidebar-right{% endblock %}
{% block title %}News & Events{% endblock %}
{% block title %}{% translate "News & Events" %}{% endblock %}

{% block og_title %}News & Events{% endblock %}
{% block og_title %}{% translate "News & Events" %}{% endblock %}

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

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

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

{% if events %}
<h2>Upcoming Events</h2>
<h2>{% translate "Upcoming Events" %}</h2>
<ul class="list-events">
{% for event in events %}
<li>
<a href="{{ event.external_url }}" target="_blank">{{ event.headline }}</a>
<span class="meta"><span>{{ event.date|date:"F j, Y" }}</span> | {{ event.location }}</span>
<span class="meta"><span>{{ event.date|date:"DATE_FORMAT" }}</span> | {{ event.location }}</span>
<i class="icon icon-calendar"></i>
</li>
{% endfor %}
</ul>
{% endif %}
<p><a href="/foundation/conferences/">Want your event listed here?</a></p>
<p><a href="/foundation/conferences/">{% translate "Want your event listed here?" %}</a></p>

{% comment %}
{# tags not implemented in backend yet #}
Expand All @@ -44,13 +44,13 @@ <h2><span>Tags</span></h2>
</ul>
{% endcomment %}

<h2><span>Archives</span></h2>
<h2><span>{% translate "Archives" %}</span></h2>
{% render_month_links %}

<h2><span>RSS Feeds</span></h2>
<h2><span>{% translate "RSS Feeds" %}</span></h2>
<ul class="list-links-small rss-list">
<li><a href="{% url 'weblog-feed' %}">Latest news entries</a></li>
<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>
<li><a href="{% url 'weblog-feed' %}">{% translate "Latest news entries" %}</a></li>
<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>
</ul>
</div>
{% endblock %}
10 changes: 7 additions & 3 deletions djangoproject/templates/blog/blog_pagination.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
{% load i18n %}

{% if is_paginated %}
<div class="pagination">
<ul class="nav-pagination" role="navigation">
{% if page_obj.has_previous %}
<li><a class="previous" href="?page={{ page_obj.previous_page_number }}">
<i class="icon icon-chevron-left"></i>
<span class="visuallyhidden">Previous</span>
<span class="visuallyhidden">{% translate "Previous" context "pagination" %}</span>
</a></li>
{% endif %}
<span class="page-current">
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
{% blocktranslate trimmed with page_num=page_obj.number pages=page_obj.paginator.num_pages %}
Page {{ page_num }} of {{ pages }}
{% endblocktranslate %}
</span>
{% if page_obj.has_next %}
<li><a class="next" href="?page={{ page_obj.next_page_number }}">
<i class="icon icon-chevron-right"></i>
<span class="visuallyhidden">Next</span>
<span class="visuallyhidden">{% translate "Next" context "pagination" %}</span>
</a></li>
{% endif %}
</ul>
Expand Down
7 changes: 4 additions & 3 deletions djangoproject/templates/blog/entry_archive_day.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{% extends "base_weblog.html" %}
{% load i18n %}

{% block title %}{{ day|date:"F j" }} | Weblog{% endblock %}
{% block title %}{{ day|date:"MONTH_DAY_FORMAT" }} | {% translate "Weblog" %}{% endblock %}

{% block og_title %}Django news: {{ day|date:"F j" }} archive{% endblock %}
{% block og_title %}{% blocktranslate %}Django news: {{ day|date:"MONTH_DAY_FORMAT" }} archive{% endblocktranslate %}{% endblock %}

{% block content %}

<h1>{{ day|date:"F j" }} archive</h1>
<h1>{% blocktranslate %}{{ day|date:"MONTH_DAY_FORMAT" }} archive{% endblocktranslate %}</h1>

<ul class="list-news">

Expand Down
7 changes: 4 additions & 3 deletions djangoproject/templates/blog/entry_archive_month.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{% extends "base_weblog.html" %}
{% load i18n %}

{% block title %}{{ month|date:"F" }} | Weblog{% endblock %}
{% block title %}{{ month|date:"YEAR_MONTH_FORMAT" }} | {% translate "Weblog" %}{% endblock %}

{% block og_title %}Django news: {{ month|date:"F Y" }} archive{% endblock %}
{% block og_title %}{% blocktranslate %}Django news: {{ month|date:"YEAR_MONTH_FORMAT" }} archive{% endblocktranslate %}{% endblock %}

{% block content %}

<h1>{{ month|date:"F Y" }} archive</h1>
<h1>{% blocktranslate %}{{ month|date:"YEAR_MONTH_FORMAT" }} archive{% endblocktranslate %}</h1>

<ul class="list-news">

Expand Down
7 changes: 4 additions & 3 deletions djangoproject/templates/blog/entry_archive_year.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{% extends "base_weblog.html" %}
{% load i18n %}

{% block title %}{{ year|date:"Y" }} | Weblog{% endblock %}
{% block title %}{{ year|date:"Y" }} | {% translate "Weblog" %}{% endblock %}

{% block og_title %}Django news: {{ year|date:"Y" }} archive{% endblock %}
{% block og_title %}{% blocktranslate with year=year|date:"Y" %}Django news: {{ year }} archive{% endblocktranslate %}{% endblock %}

{% block content %}

<h1>{{ year|date:"Y" }} archive</h1>
<h1>{{ year|date:"Y" }} {% translate "archive" %}</h1>

<ul class="list-news">

Expand Down
12 changes: 8 additions & 4 deletions djangoproject/templates/blog/entry_detail.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{% extends "base_weblog.html" %}
{% load i18n %}

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

{% block og_title %}{{ object.headline|safe }}{% endblock %}
{% block og_description %}Posted by {{ object.author }} on {{ object.pub_date|date:"F j, Y" }}{% endblock %}
{% block og_description %}{% blocktranslate trimmed with author=object.author pub_date=object.pub_date|date:"DATE_FORMAT" %}
Posted by {{ author }} on {{ pub_date }}
{% endblocktranslate %}{% endblock %}

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

<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>

{{ object.body_html|safe }}
<span class="meta">{% blocktranslate trimmed with author=object.author pub_date=object.pub_date|date:"DATE_FORMAT" %}
Posted by <strong>{{ author }}</strong> on {{ pub_date }} </span>
{% endblocktranslate %}
{{ object.body_html|safe }}
{% endblock %}
2 changes: 1 addition & 1 deletion djangoproject/templates/blog/month_links_snippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h2><a href="{% url 'weblog:archive-year' month.grouper %}">{{ month.grouper }}<
<div class="collapsing-content">
<ul class="list-links-small">
{% for d in month.list %}
<li><a href="{% language "en" %}{% url 'weblog:archive-month' d|date:"Y" d|date:"b" %}{% endlanguage %}">{{ d|date:"F Y" }}</a></li>
<li><a href="{% language "en" %}{% url 'weblog:archive-month' d|date:"Y" d|date:"b" %}{% endlanguage %}">{{ d|date:"YEAR_MONTH_FORMAT" }}</a></li>
{% endfor %}
</ul>
<p></p>
Expand Down
10 changes: 8 additions & 2 deletions djangoproject/templates/blog/news_summary.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% load i18n %}

<li{% if not object.is_published %} class="unpublished"{% endif %}>
<{{ header_tag|default:'h2' }}>
<a href="{{ object.get_absolute_url }}">{{ object.headline|safe }}</a>
Expand All @@ -6,12 +8,16 @@
{{ object.summary_html|safe }}
{% endif %}
<span class="meta">
Posted by <strong>{{ object.author }}</strong> on {{ object.pub_date|date:"F j, Y" }}
{% blocktranslate trimmed with author=object.author pub_date=object.pub_date|date:"DATE_FORMAT" %}
Posted by <strong>{{ author }}</strong> on {{ pub_date }}
{% endblocktranslate %}
</span>
{% if not summary_first %}
{{ object.summary_html|safe }}
{% endif %}
{% if not hide_readmore %}
<a class="link-readmore" href="{{ object.get_absolute_url }}">Read more</a>
<a class="link-readmore" href="{{ object.get_absolute_url }}">
{% translate "Read more" context "Following article summary" %}
</a>
{% endif %}
</li>

0 comments on commit 910e7c8

Please sign in to comment.