diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6174f19 --- /dev/null +++ b/Makefile @@ -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 + diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 0000000..2274808 --- /dev/null +++ b/babel.cfg @@ -0,0 +1 @@ +[jinja2: templates/**.html] diff --git a/messages.pot b/messages.pot new file mode 100644 index 0000000..191ff8e --- /dev/null +++ b/messages.pot @@ -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 , 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 \n" +"Language-Team: LANGUAGE \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 "" + diff --git a/templates/archives.html b/templates/archives.html index 15149cb..071835d 100644 --- a/templates/archives.html +++ b/templates/archives.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% block title %}{{ SITENAME }} - Archives{% endblock %} +{% block title %}{{ SITENAME }} - {{ gettext('Archives') }} {% endblock %} {% block header %} @@ -15,7 +15,7 @@
-

Archives for {{ SITENAME }}

+

{{ gettext('Archives for %(name)s', name=SITENAME) }}

diff --git a/templates/article.html b/templates/article.html index c5dc9dc..e7f6086 100644 --- a/templates/article.html +++ b/templates/article.html @@ -105,14 +105,14 @@ {% if article.headline %}

{{ article.headline }}

{% endif %} - Posted by + {{ gettext('Posted by') }} {% for author in article.authors %} {{ author }} {% endfor %} - on {{ article.locale_date }} + {{ gettext('on') }} {{ article.locale_date }} {% if article.modified %} - Updated on {{ article.locale_modified }} + {{ gettext('Updated on %(moddate)s', moddate=article.locale_modified) }} {% endif %} {% import 'translations.html' as translations with context %} {{ translations.translations_for(article) }} @@ -131,7 +131,7 @@ {% if article.tags %}
-

tags: {% for tag in article.tags %}{{ tag | escape }}{% if not loop.last %}, {% endif %}{% endfor %}

+

{{ gettext('tags') }} : {% for tag in article.tags %}{{ tag | escape }}{% if not loop.last %}, {% endif %}{% endfor %}

{% endif %} @@ -152,7 +152,7 @@ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); - + {% endif %} {% endblock content %} diff --git a/templates/author.html b/templates/author.html index 65aff95..f526ad5 100644 --- a/templates/author.html +++ b/templates/author.html @@ -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() }} - + @@ -24,7 +24,7 @@
-

Articles by {{ author }}

+

{{ gettext('Articles by %(name)s', name=author) }}

diff --git a/templates/authors.html b/templates/authors.html index 74917a8..73c9df9 100644 --- a/templates/authors.html +++ b/templates/authors.html @@ -1,6 +1,6 @@ {% extends "index.html" %} -{% block title %}{{ SITENAME }} - Authors{% endblock title %} +{% block title %}{{ SITENAME }} - {{ gettext('Authors') }}{% endblock title %} {% block header %} @@ -15,7 +15,7 @@
-

Articles by {{ author }}

+

{{ gettext('Articles by %(name)s', name=author) }}

diff --git a/templates/categories.html b/templates/categories.html index 7af5236..0883d7b 100644 --- a/templates/categories.html +++ b/templates/categories.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% block title %}{{ SITENAME }} - Categories{% endblock %} +{% block title %}{{ SITENAME }} - {{ gettext('Categories') }}{% endblock %} {% block header %} @@ -15,7 +15,7 @@
-

{{ SITENAME }} - Categories

+

{{ SITENAME }} - {{ gettext('Categories') }}

diff --git a/templates/category.html b/templates/category.html index 53b8879..443b208 100644 --- a/templates/category.html +++ b/templates/category.html @@ -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 %} @@ -15,7 +15,7 @@
-

Articles in the {{ category }} category

+

{{ gettext('Articles in the %(category)s category', category=category) }}

diff --git a/templates/index.html b/templates/index.html index 6eeba7a..168742a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -58,11 +58,11 @@ {% endif %}

{% endif %} - {% include 'comments.html' %} diff --git a/templates/pagination.html b/templates/pagination.html index 22b7e54..1cc50c8 100644 --- a/templates/pagination.html +++ b/templates/pagination.html @@ -4,10 +4,10 @@ diff --git a/templates/period_archives.html b/templates/period_archives.html index 19fdaa9..8c6b6aa 100644 --- a/templates/period_archives.html +++ b/templates/period_archives.html @@ -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 %} @@ -15,7 +15,7 @@
-

Archives for {{ period | reverse | join (' ') }}

+

{{ gettext('Archives for %(period)s', period=period | reverse | join (' ')) }}

diff --git a/templates/tag.html b/templates/tag.html index 108d5be..9a8ad78 100644 --- a/templates/tag.html +++ b/templates/tag.html @@ -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 %}
diff --git a/templates/tags.html b/templates/tags.html index bab699f..48ef873 100644 --- a/templates/tags.html +++ b/templates/tags.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% block title %}{{ SITENAME }} - Tags{% endblock %} +{% block title %}{{ SITENAME }} - {{ gettext('Tags') }}{% endblock %} {% block header %} @@ -15,7 +15,7 @@
-

{{ SITENAME }} - Tags

+

{{ SITENAME }} - {{ gettext('Tags') }}

@@ -24,7 +24,7 @@ {% endblock header %} {% block content %} -

Tags for {{ SITENAME }}

+

{{ gettext('Tags for %(sitename)s', sitename=SITENAME) }}

{%- for tag, articles in tags|sort %}
  • {{ tag }} ({{ articles|count }})
  • {% endfor %} diff --git a/translations/ja/LC_MESSAGES/messages.mo b/translations/ja/LC_MESSAGES/messages.mo new file mode 100644 index 0000000..effb290 Binary files /dev/null and b/translations/ja/LC_MESSAGES/messages.mo differ diff --git a/translations/ja/LC_MESSAGES/messages.po b/translations/ja/LC_MESSAGES/messages.po new file mode 100644 index 0000000..02ff265 --- /dev/null +++ b/translations/ja/LC_MESSAGES/messages.po @@ -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 , 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\n" +"Language: ja\n" +"Language-Team: ja \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 のタグ"