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 +1,2 @@
[jinja2: templates/**.html] [jinja2: templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_

View file

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

View file

@ -13,7 +13,13 @@
<article> <article>
<header> <header>
<h1 id="{{ article.slug }}">{{ article.title }}</h1> <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> </header>
<div> <div>
{{ article.content }} {{ article.content }}
@ -29,14 +35,14 @@
</div> </div>
{% if ADD_THIS_ID %} {% if ADD_THIS_ID %}
<div class="center social-share"> <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_native_toolbox"></div>
<div class="addthis_sharing_toolbox"></div> <div class="addthis_sharing_toolbox"></div>
</div> </div>
{% endif %} {% endif %}
{% if article.related_posts %} {% if article.related_posts %}
<div class="related-posts"> <div class="related-posts">
<h4>{% trans %}Related posts{% endtrans %}:</h4> <h4>{{ _('Related posts') }}:</h4>
<ul> <ul>
{% for related_post in article.related_posts %} {% for related_post in article.related_posts %}
<li><a href="{{ SITEURL }}/{{ related_post.url }}">{{ related_post.title }}</a></li> <li><a href="{{ SITEURL }}/{{ related_post.url }}">{{ related_post.title }}</a></li>

View file

@ -1,3 +1,3 @@
{% extends "index.html" %} {% 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 %} {% set summarise = True %}

View file

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

View file

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

View file

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

View file

@ -6,22 +6,26 @@
<header> <header>
<h2><a href="{{ SITEURL }}/{{ article.url }}#{{ article.slug }}">{{ article.title }}</a></h2> <h2><a href="{{ SITEURL }}/{{ article.url }}#{{ article.slug }}">{{ article.title }}</a></h2>
<p> <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 %} {% if article.tags %}
&#8226; {% trans %}Tagged with{% endtrans %} &#8226; {{ ngettext('Tag', 'Tags', article.tags|count) }}:
{% for tag in article.tags %} {% for tag in article.tags %}
<a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>{% if not loop.last %},{% endif %} <a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>{% if not loop.last %},{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if DISQUS_SITENAME %} {% 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 %} {% endif %}
</p> </p>
</header> </header>
<div> <div>
{% if summarise or article.metadata['summary'] or SUMMARY_MAX_LENGTH %} {% if summarise or article.metadata['summary'] or SUMMARY_MAX_LENGTH %}
{{ article.summary }} {{ 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 %} {% else %}
{{ article.content }} {{ article.content }}
{% endif %} {% endif %}

View file

@ -8,5 +8,11 @@
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})(); })();
</script> </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 %} {% 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"> <div class="pagination">
{% if articles_page.has_next() %} {% if articles_page.has_next() %}
<a class="btn" href="{{ SITEURL }}/{{ articles_next_page.url }}"> <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> </a>
{% endif %} {% endif %}
{% if articles_page.has_previous() %} {% if articles_page.has_previous() %}
<a class="btn float-right" href="{{ SITEURL }}/{{ articles_previous_page.url }}"> <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> </a>
{% endif %} {% endif %}
</div> </div>

View file

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

View file

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

View file

@ -1,13 +1,14 @@
# German translations for pelican Flex theme by Alexandre Vicenzi. # German translations for pelican Flex theme by Alexandre Vicenzi.
# Copyright (C) 2016 Marcel Huth # Copyright (C) 2016 Marcel Huth
# This file is distributed under the same license as the Flex theme by Alexandre Vicenzi project. # This file is distributed under the same license as the Flex theme by
# Alexandre Vicenzi project.
# Marcel Huth <marcelhuth@users.noreply.github.com>, 2016. # Marcel Huth <marcelhuth@users.noreply.github.com>, 2016.
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 1.0\n" "Project-Id-Version: 1.1\n"
"Report-Msgid-Bugs-To: marcelhuth@users.noreply.github.com\n" "Report-Msgid-Bugs-To: marcelhuth@users.noreply.github.com\n"
"POT-Creation-Date: 2016-07-30 13:55+0200\n" "POT-Creation-Date: 2016-08-10 18:20+0200\n"
"PO-Revision-Date: 2016-07-30 13:56+0200\n" "PO-Revision-Date: 2016-07-30 13:56+0200\n"
"Last-Translator: Marcel Huth <marcelhuth@users.noreply.github.com>\n" "Last-Translator: Marcel Huth <marcelhuth@users.noreply.github.com>\n"
"Language: de\n" "Language: de\n"
@ -22,25 +23,23 @@ msgstr ""
msgid "Archives" msgid "Archives"
msgstr "Archive" msgstr "Archive"
#: templates/article.html:16 templates/index.html:9 #: templates/article.html:18 templates/index.html:10
msgid "Posted on" #, python-format
msgstr "Online seit" msgid "Posted on %(when)s in %(category)s"
msgstr "Online seit %(when)s in %(category)s"
#: templates/article.html:16 templates/index.html:9 #: templates/article.html:38
msgid "in"
msgstr "in"
#: templates/article.html:32
msgid "Like this article? Share it with your friends!" msgid "Like this article? Share it with your friends!"
msgstr "Gef&auml;llt dir der Artikel? Dann teile ihn mit Freunden!" msgstr "Gef&auml;llt dir der Artikel? Dann teile ihn mit Freunden!"
#: templates/article.html:39 #: templates/article.html:45
msgid "Related posts" msgid "Related posts"
msgstr "&Auml;hnliche Artikel" msgstr "&Auml;hnliche Artikel"
#: templates/author.html:2 #: templates/author.html:2
msgid "Posts by" #, python-format
msgstr "Geschrieben von" msgid "Posts by %(name)s"
msgstr "Artikel von %(name)s"
#: templates/authors.html:2 templates/authors.html:7 #: templates/authors.html:2 templates/authors.html:7
msgid "Authors" msgid "Authors"
@ -51,44 +50,46 @@ msgid "Categories"
msgstr "Kategorien" msgstr "Kategorien"
#: templates/category.html:2 #: templates/category.html:2
msgid "Category" #, python-format
msgstr "Kategorie" msgid "Category: %(name)s"
msgstr "Kategorie: %(name)s"
#: templates/index.html:11 #: templates/index.html:15
msgid "Tagged with" msgid "Tag"
msgstr "Stichw&ouml;rter" msgid_plural "Tags"
msgstr[0] "Stichwort"
msgstr[1] "Stichw&ouml;rter"
#: templates/index.html:17 #: templates/index.html:21
msgid "Leave a comment" msgid "Leave a comment"
msgstr "Schreib einen Kommentar" msgstr "Hinterlasse ein Kommentar"
#: templates/index.html:24 #: templates/index.html:28
msgid "Continue reading" msgid "Continue reading"
msgstr "Weiterlesen" msgstr "Weiterlesen"
#: templates/tag.html:2 #: templates/tag.html:2
msgid "Tag" #, python-format
msgstr "Stichw&ouml;rt" msgid "Tag: %(name)s"
msgstr "Stichwort: %(name)s"
#: templates/tags.html:2 templates/tags.html:7 #: templates/tags.html:2 templates/tags.html:7
msgid "Tags" msgid "Tags"
msgstr "Stichw&ouml;rter" msgstr "Stichw&ouml;rter"
#: templates/partial/disqus.html:11 #: templates/partial/disqus.html:13
msgid "Please enable JavaScript to view the" #, python-format
msgstr "Bitte aktiviere JavaScript um die" msgid ""
"Please enable JavaScript to view the %(link)scomments powered by "
"Disqus%(endlink)s"
msgstr ""
"Bitte JavaScript aktivieren um die %(link)sKommentare von "
"Disqus%(endlink)s zu lesen"
#: templates/partial/disqus.html:11 #: templates/partial/flex.html:2
msgid "comments powered by Disqus" #, python-format
msgstr "Kommentare von Disqus anzuzeigen" msgid "Build using %(pelican)s - %(flex)s theme by %(alexandrevicenzi)s"
msgstr "Erstellt mit %(pelican)s - %(flex)s Design von %(alexandrevicenzi)s"
#: templates/partial/flex.html:1
msgid "Built using"
msgstr "Erstellt mit"
#: templates/partial/flex.html:1
msgid "theme by"
msgstr "Theme von"
#: templates/partial/pagination.html:5 #: templates/partial/pagination.html:5
msgid "Older Posts" msgid "Older Posts"