Reworked to newstyle gettext and named vars

This commit is contained in:
Marcel Huth 2016-08-10 19:28:32 +02:00
parent 36d06accb0
commit 5497850c51
14 changed files with 83 additions and 60 deletions

View file

@ -1,10 +1,10 @@
{% extends "base.html" %}
{% block title %} – {% trans %}Archives{% endtrans %}{% endblock %}
{% block title %} – {{ _('Archives') }}{% endblock %}
{% block content %}
<article>
<header>
<h1>{% trans %}Archives{% endtrans %}</h1>
<h1>{{ _('Archives') }}</h1>
</header>
<div>
<dl>

View file

@ -13,7 +13,13 @@
<article>
<header>
<h1 id="{{ article.slug }}">{{ article.title }}</h1>
<p>{% trans %}Posted on{% endtrans %} {{ article.locale_date }} {% trans %}in{% endtrans %} <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a></p>
<p>
{% autoescape false %}
{{ _('Posted on %(when)s in %(category)s',
when=article.locale_date,
category='<a href="%s/%s">%s</a>' % (SITEURL, article.category.url, article.category)) }}
{% endautoescape %}
</p>
</header>
<div>
{{ article.content }}
@ -29,14 +35,14 @@
</div>
{% if ADD_THIS_ID %}
<div class="center social-share">
<p>{% trans %}Like this article? Share it with your friends!{% endtrans %}</p>
<p>{{ _('Like this article? Share it with your friends!') }}</p>
<div class="addthis_native_toolbox"></div>
<div class="addthis_sharing_toolbox"></div>
</div>
{% endif %}
{% if article.related_posts %}
<div class="related-posts">
<h4>{% trans %}Related posts{% endtrans %}:</h4>
<h4>{{ _('Related posts') }}:</h4>
<ul>
{% for related_post in article.related_posts %}
<li><a href="{{ SITEURL }}/{{ related_post.url }}">{{ related_post.title }}</a></li>

View file

@ -1,3 +1,3 @@
{% extends "index.html" %}
{% block title %} &ndash; {% trans %}Posts by{% endtrans %}: {{ author }}{% endblock %}
{% block title %} &ndash; {{ _('Posts by %(name)s', name=author) }}:{% endblock %}
{% set summarise = True %}

View file

@ -1,10 +1,10 @@
{% extends "base.html" %}
{% block title %} &ndash; {% trans %}Authors{% endtrans %}{% endblock %}
{% block title %} &ndash; {{ _('Authors') }}{% endblock %}
{% block content %}
<article>
<header>
<h1>{% trans %}Authors{% endtrans %}</h1>
<h1>{{ _('Authors') }}</h1>
</header>
<div>
<ul class="list">

View file

@ -1,10 +1,10 @@
{% extends "base.html" %}
{% block title %} &ndash; {% trans %}Categories{% endtrans %}{% endblock %}
{% block title %} &ndash; {{ _('Categories') }}{% endblock %}
{% block content %}
<article>
<header>
<h1>{% trans %}Categories{% endtrans %}</h1>
<h1>{{ _('Categories') }}</h1>
</header>
<div>
<ul class="list">

View file

@ -1,3 +1,3 @@
{% extends "index.html" %}
{% block title %} &ndash; {% trans %}Category{% endtrans %}: {{ category }}{% endblock %}
{% block title %} &ndash; {{ _('Category: %(name)s', name=category) }}{% endblock %}
{% set summarise = True %}

View file

@ -6,22 +6,26 @@
<header>
<h2><a href="{{ SITEURL }}/{{ article.url }}#{{ article.slug }}">{{ article.title }}</a></h2>
<p>
{% trans %}Posted on{% endtrans %} {{ article.locale_date }} {% trans %}in{% endtrans %} <a href="{{ SITEURL }}/{{ article.category.url }}">{{ article.category }}</a>
{% autoescape false %}
{{ _('Posted on %(when)s in %(category)s',
when=article.locale_date,
category='<a href="%s/%s">%s</a>' % (SITEURL, article.category.url, article.category)) }}
{% endautoescape %}
{% if article.tags %}
&#8226; {% trans %}Tagged with{% endtrans %}
&#8226; {{ ngettext('Tag', 'Tags', article.tags|count) }}:
{% for tag in article.tags %}
<a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>{% if not loop.last %},{% endif %}
{% endfor %}
{% endif %}
{% if DISQUS_SITENAME %}
&#8226; <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread">{% trans %}Leave a comment{% endtrans %}</a>
&#8226; <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread">{{ _('Leave a comment') }}</a>
{% endif %}
</p>
</header>
<div>
{% if summarise or article.metadata['summary'] or SUMMARY_MAX_LENGTH %}
{{ article.summary }}
<a class="btn" href="{{ SITEURL }}/{{ article.url }}#{{ article.slug }}">{% trans %}Continue reading{% endtrans %}</a>
<a class="btn" href="{{ SITEURL }}/{{ article.url }}#{{ article.slug }}">{{ _('Continue reading') }}</a>
{% else %}
{{ article.content }}
{% endif %}

View file

@ -8,5 +8,11 @@
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>{% trans %}Please enable JavaScript to view the{% endtrans %} <a href="https://disqus.com/?ref_noscript" rel="nofollow">{% trans %}comments powered by Disqus{% endtrans %}.</a></noscript>
<noscript>
{% autoescape false %}
{{ _('Please enable JavaScript to view the %(link)scomments powered by Disqus%(endlink)s',
link='<a href="https://disqus.com/?ref_noscript" rel="nofollow">',
endlink='</a>') }}
{% endautoescape %}
</noscript>
{% endif %}

View file

@ -1 +1,6 @@
<p>{% trans %}Built using{% endtrans %} <a href="http://getpelican.com" target="_blank">Pelican</a> - <a href="https://github.com/alexandrevicenzi/flex" target="_blank">Flex</a> {% trans %}theme by{% endtrans %} <a href="http://alexandrevicenzi.com" target="_blank">Alexandre Vicenzi</a></p>
{% autoescape false %}
<p>{{ _('Build using %(pelican)s - %(flex)s theme by %(alexandrevicenzi)s',
pelican='<a href="http://getpelican.com" target="_blank">Pelican</a>',
flex='<a href="https://github.com/alexandrevicenzi/flex" target="_blank">Flex</a>',
alexandrevicenzi='<a href="http://alexandrevicenzi.com" target="_blank">Alexandre Vicenzi</a>') }}</p>
{% endautoescape %}

View file

@ -2,12 +2,12 @@
<div class="pagination">
{% if articles_page.has_next() %}
<a class="btn" href="{{ SITEURL }}/{{ articles_next_page.url }}">
<i class="fa fa-angle-left"></i> {% trans %}Older Posts{% endtrans %}
<i class="fa fa-angle-left"></i> {{ _('Older Posts') }}
</a>
{% endif %}
{% if articles_page.has_previous() %}
<a class="btn float-right" href="{{ SITEURL }}/{{ articles_previous_page.url }}">
{% trans %}Newer Posts{% endtrans %} <i class="fa fa-angle-right"></i>
{{ _('Newer Posts') }} <i class="fa fa-angle-right"></i>
</a>
{% endif %}
</div>

View file

@ -1,3 +1,3 @@
{% extends "index.html" %}
{% block title %} &ndash; {% trans %}Tag{% endtrans %}: {{ tag }}{% endblock %}
{% block title %} &ndash; {{ _('Tag: %(name)s', name=tag) }}{% endblock %}
{% set summarise = True %}

View file

@ -1,10 +1,10 @@
{% extends "base.html" %}
{% block title %} &ndash; {% trans %}Tags{% endtrans %}{% endblock %}
{% block title %} &ndash; {{ _('Tags') }}{% endblock %}
{% block content %}
<article>
<header>
<h1>{% trans %}Tags{% endtrans %}</h1>
<h1>{{ _('Tags') }}</h1>
</header>
<div>
<ul class="list">