Merge pull request #60 from ptigwe/localize

Localise clean-blog Theme
This commit is contained in:
Gilson Filho 2017-04-12 12:23:00 -03:00 committed by GitHub
commit 7572322a86
16 changed files with 238 additions and 26 deletions

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
help:
@echo 'Makefile for localization'
@echo ''
@echo 'Usage:'
@echo ' make extract Extract translatable strings from templates'
@echo ' make init lang=lang Initialize the message catalogs with a new language (e.g make init lang=ja)'
@echo ' make compile Compile the message catalogs'
@echo ' make update Update the catalogs when templates change'
extract:
pybabel extract --mapping babel.cfg --output messages.pot ./
init:
pybabel init --input-file messages.pot --output-dir translations/ --locale $$lang --domain messages
compile:
pybabel compile --directory translations/ --domain messages
update:
pybabel update --input-file messages.pot --output-dir translations/ --domain messages

1
babel.cfg Normal file
View File

@ -0,0 +1 @@
[jinja2: templates/**.html]

95
messages.pot Normal file
View File

@ -0,0 +1,95 @@
# Translations template for PROJECT.
# Copyright (C) 2017 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2017.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2017-04-06 06:29+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
#: templates/archives.html:3
msgid "Archives"
msgstr ""
#: templates/archives.html:18
#, python-format
msgid "Archives for %(name)s"
msgstr ""
#: templates/article.html:108 templates/index.html:61
msgid "Posted by"
msgstr ""
#: templates/article.html:112 templates/index.html:65
msgid "on"
msgstr ""
#: templates/article.html:115
#, python-format
msgid "Updated on %(moddate)s"
msgstr ""
#: templates/article.html:134
msgid "tags"
msgstr ""
#: templates/article.html:155
msgid "Please enable JavaScript to view the comments."
msgstr ""
#: templates/author.html:3 templates/author.html:7 templates/author.html:27
#: templates/authors.html:18
#, python-format
msgid "Articles by %(name)s"
msgstr ""
#: templates/authors.html:3
msgid "Authors"
msgstr ""
#: templates/categories.html:3 templates/categories.html:18
msgid "Categories"
msgstr ""
#: templates/category.html:3 templates/category.html:18
#, python-format
msgid "Articles in the %(category)s category"
msgstr ""
#: templates/pagination.html:7
msgid "Older Posts"
msgstr ""
#: templates/pagination.html:10
msgid "Newest Posts"
msgstr ""
#: templates/period_archives.html:3 templates/period_archives.html:18
#, python-format
msgid "Archives for %(period)s"
msgstr ""
#: templates/tag.html:2
#, python-format
msgid "Tag %(tag)s"
msgstr ""
#: templates/tags.html:3 templates/tags.html:18
msgid "Tags"
msgstr ""
#: templates/tags.html:27
#, python-format
msgid "Tags for %(sitename)s"
msgstr ""

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}{{ SITENAME }} - Archives{% endblock %}
{% block title %}{{ SITENAME }} - {{ gettext('Archives') }} {% endblock %}
{% block header %}
<!-- Page Header -->
@ -15,7 +15,7 @@
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post-heading">
<h1>Archives for {{ SITENAME }}</h1>
<h1>{{ gettext('Archives for %(name)s', name=SITENAME) }}</h1>
</div>
</div>
</div>

View File

@ -105,14 +105,14 @@
{% if article.headline %}
<h3 class="subheading">{{ article.headline }}</h3>
{% endif %}
<span class="meta">Posted by
<span class="meta">{{ gettext('Posted by') }}
{% for author in article.authors %}
<a href="{{ SITEURL }}/{{ author.url }}">{{ author }}</a>
{% endfor %}
on {{ article.locale_date }}
{{ gettext('on') }} {{ article.locale_date }}
</span>
{% if article.modified %}
<span class="meta">Updated on {{ article.locale_modified }}</span>
<span class="meta">{{ gettext('Updated on %(moddate)s', moddate=article.locale_modified) }}</span>
{% endif %}
{% import 'translations.html' as translations with context %}
{{ translations.translations_for(article) }}
@ -131,7 +131,7 @@
{% if article.tags %}
<div class="tags">
<p>tags: {% for tag in article.tags %}<a href="{{ SITEURL }}/{{ tag.url }}">{{ tag | escape }}</a>{% if not loop.last %}, {% endif %}{% endfor %}</p>
<p>{{ gettext('tags') }} : {% for tag in article.tags %}<a href="{{ SITEURL }}/{{ tag.url }}">{{ tag | escape }}</a>{% if not loop.last %}, {% endif %}{% endfor %}</p>
</div>
{% endif %}
@ -152,7 +152,7 @@
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the comments.</noscript>
<noscript>{{ gettext('Please enable JavaScript to view the comments.') }}</noscript>
</div>
{% endif %}
{% endblock content %}

View File

@ -1,10 +1,10 @@
{% extends "index.html" %}
{% block title %}{{ SITENAME }} - Articles by {{ author }}{% endblock %}
{% block title %}{{ SITENAME }} - {{ gettext('Articles by %(name)s', name=author) }}{% endblock %}
{% block opengraph %}
{{ super() }}
<meta property="og:title" content="{{ SITENAME }} - Articles by {{ author }}">
<meta property="og:title" content="{{ SITENAME }} - {{ gettext('Articles by %(name)s', name=author) }}">
<meta property="og:type" content="profile">
<meta property="profile:first_name" content="{{ author.name.split(' ')[0] }}">
<meta property="profile:last_name" content="{{ author.name.split(' ')[1:]|join(' ') }}">
@ -24,7 +24,7 @@
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post-heading">
<h1>Articles by {{ author }}</h1>
<h1>{{ gettext('Articles by %(name)s', name=author) }}</h1>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
{% extends "index.html" %}
{% block title %}{{ SITENAME }} - Authors{% endblock title %}
{% block title %}{{ SITENAME }} - {{ gettext('Authors') }}{% endblock title %}
{% block header %}
<!-- Page Header -->
@ -15,7 +15,7 @@
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post-heading">
<h1>Articles by {{ author }}</h1>
<h1>{{ gettext('Articles by %(name)s', name=author) }}</h1>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}{{ SITENAME }} - Categories{% endblock %}
{% block title %}{{ SITENAME }} - {{ gettext('Categories') }}{% endblock %}
{% block header %}
<!-- Page Header -->
@ -15,7 +15,7 @@
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post-heading">
<h1>{{ SITENAME }} - Categories</h1>
<h1>{{ SITENAME }} - {{ gettext('Categories') }}</h1>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
{% extends "index.html" %}
{% block title %}{{ SITENAME }} - Articles in the {{ category }} category{% endblock %}
{% block title %}{{ SITENAME }} - {{ gettext('Articles in the %(category)s category', category=category) }}{% endblock %}
{% block header %}
<!-- Page Header -->
@ -15,7 +15,7 @@
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post-heading">
<h1>Articles in the {{ category }} category</h1>
<h1>{{ gettext('Articles in the %(category)s category', category=category) }}</h1>
</div>
</div>
</div>

View File

@ -58,11 +58,11 @@
{% endif %}
</p>
{% endif %}
<p class="post-meta">Posted by
<p class="post-meta">{{ gettext('Posted by') }}
{% for author in article.authors %}
<a href="{{ SITEURL }}/{{ author.url }}">{{ author }}</a>
{% endfor %}
on {{ article.locale_date }}
{{ gettext('on') }} {{ article.locale_date }}
</p>
{% include 'comments.html' %}
</div>

View File

@ -4,10 +4,10 @@
<ul class="pager">
<li class="next">
{% if articles_page.has_next() %}
<a href="{{ SITEURL }}/{{ articles_next_page.url }}">Older Posts &rarr;</a>
<a href="{{ SITEURL }}/{{ articles_next_page.url }}">{{ gettext('Older Posts') }} &rarr;</a>
{% endif %}
{% if articles_page.has_previous() %}
<a href="{{ SITEURL }}/{{ articles_previous_page.url }}"> &larr; Newest Posts</a>
<a href="{{ SITEURL }}/{{ articles_previous_page.url }}"> &larr; {{ gettext('Newest Posts') }}</a>
{% endif %}
</li>
</ul>

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}{{ SITENAME }} - Archives for {{ period | reverse | join (' ') }}{% endblock %}
{% block title %}{{ SITENAME }} - {{ gettext('Archives for %(period)s', period=period | reverse | join (' ')) }}{% endblock %}
{% block header %}
<!-- Page Header -->
@ -15,7 +15,7 @@
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post-heading">
<h1>Archives for {{ period | reverse | join (' ') }}</h1>
<h1>{{ gettext('Archives for %(period)s', period=period | reverse | join (' ')) }}</h1>
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
{% extends "index.html" %}
{% block title %}{{ SITENAME }} - Tag {{ tag }}{% endblock %}
{% block title %}{{ SITENAME }} - {{ gettext('Tag %(tag)s', tag=tag) }}{% endblock %}
{% block header %}
{% if HEADER_COVER %}
<header class="intro-header" style="background-image: url('{{ HEADER_COVER }}')">

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}{{ SITENAME }} - Tags{% endblock %}
{% block title %}{{ SITENAME }} - {{ gettext('Tags') }}{% endblock %}
{% block header %}
<!-- Page Header -->
@ -15,7 +15,7 @@
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post-heading">
<h1>{{ SITENAME }} - Tags</h1>
<h1>{{ SITENAME }} - {{ gettext('Tags') }}</h1>
</div>
</div>
</div>
@ -24,7 +24,7 @@
{% endblock header %}
{% block content %}
<h1>Tags for {{ SITENAME }}</h1>
<h1>{{ gettext('Tags for %(sitename)s', sitename=SITENAME) }}</h1>
{%- for tag, articles in tags|sort %}
<li><a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a> ({{ articles|count }})</li>
{% endfor %}

Binary file not shown.

View File

@ -0,0 +1,95 @@
# Japanese translations for PROJECT.
# Copyright (C) 2017 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2017-04-06 06:29+0100\n"
"PO-Revision-Date: 2017-04-06 05:18+0100\n"
"Last-Translator: Tobenna Peter, Igwe<ptigwe@gmail.com>\n"
"Language: ja\n"
"Language-Team: ja <LL@li.org>\n"
"Plural-Forms: nplurals=1; plural=0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
#: templates/archives.html:3
msgid "Archives"
msgstr "アーカイブ"
#: templates/archives.html:18
#, python-format
msgid "Archives for %(name)s"
msgstr "%(name)s のアーカイブ"
#: templates/article.html:108 templates/index.html:61
msgid "Posted by"
msgstr "投稿者"
#: templates/article.html:112 templates/index.html:65
msgid "on"
msgstr "日付"
#: templates/article.html:115
#, python-format
msgid "Updated on %(moddate)s"
msgstr "更新日 %(moddate)s"
#: templates/article.html:134
msgid "tags"
msgstr "タグ"
#: templates/article.html:155
msgid "Please enable JavaScript to view the comments."
msgstr "コメントを読み書きのため、JavaScriptを有効にしてください。"
#: templates/author.html:3 templates/author.html:7 templates/author.html:27
#: templates/authors.html:18
#, python-format
msgid "Articles by %(name)s"
msgstr "%(name)s の記事"
#: templates/authors.html:3
msgid "Authors"
msgstr "作者"
#: templates/categories.html:3 templates/categories.html:18
msgid "Categories"
msgstr "カテゴリー"
#: templates/category.html:3 templates/category.html:18
#, python-format
msgid "Articles in the %(category)s category"
msgstr "%(category)s カテゴリーの記事"
#: templates/pagination.html:7
msgid "Older Posts"
msgstr "古い"
#: templates/pagination.html:10
msgid "Newest Posts"
msgstr "新しい"
#: templates/period_archives.html:3 templates/period_archives.html:18
#, python-format
msgid "Archives for %(period)s"
msgstr "%(period)s のアーカイブ"
#: templates/tag.html:2
#, python-format
msgid "Tag %(tag)s"
msgstr "%(tag)s タグ"
#: templates/tags.html:3 templates/tags.html:18
msgid "Tags"
msgstr "タグ"
#: templates/tags.html:27
#, python-format
msgid "Tags for %(sitename)s"
msgstr "%(sitename)s のタグ"