gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-docs-landing] branch master updated (04f962f -> cb0d


From: gnunet
Subject: [GNUnet-SVN] [taler-docs-landing] branch master updated (04f962f -> cb0dc96)
Date: Mon, 24 Sep 2018 15:54:26 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a change to branch master
in repository docs-landing.

    from 04f962f  new API docs
     new 962b477  i18n first batch.
     new 9e3812a  Testing a first translation.
     new 3a6dabb  New translateable sections + README.
     new cb0dc96  Renaming file.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore                        | 10 ++++++
 Makefile                          | 32 +++++++++++++++++
 babel.map                         |  2 ++
 i18n-README                       | 15 ++++++++
 index.html => index.html.j2       |  2 +-
 locale/de/LC_MESSAGES/messages.po | 23 ++++++++++++
 locale/en/LC_MESSAGES/messages.po | 23 ++++++++++++
 locale/es/LC_MESSAGES/messages.po | 23 ++++++++++++
 locale/fr/LC_MESSAGES/messages.po | 23 ++++++++++++
 locale/it/LC_MESSAGES/messages.po | 23 ++++++++++++
 locale/messages.pot               | 23 ++++++++++++
 locale/pt/LC_MESSAGES/messages.po | 23 ++++++++++++
 locale/ru/LC_MESSAGES/messages.po | 24 +++++++++++++
 template.py                       | 76 +++++++++++++++++++++++++++++++++++++++
 14 files changed, 321 insertions(+), 1 deletion(-)
 create mode 100644 .gitignore
 create mode 100644 Makefile
 create mode 100644 babel.map
 create mode 100644 i18n-README
 rename index.html => index.html.j2 (97%)
 create mode 100644 locale/de/LC_MESSAGES/messages.po
 create mode 100644 locale/en/LC_MESSAGES/messages.po
 create mode 100644 locale/es/LC_MESSAGES/messages.po
 create mode 100644 locale/fr/LC_MESSAGES/messages.po
 create mode 100644 locale/it/LC_MESSAGES/messages.po
 create mode 100644 locale/messages.pot
 create mode 100644 locale/pt/LC_MESSAGES/messages.po
 create mode 100644 locale/ru/LC_MESSAGES/messages.po
 create mode 100755 template.py

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..992a847
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+**.mo
+**.po~
+de/*
+en/*
+es/*
+ru/*
+pt/*
+fr/*
+it/*
+*.swp
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..47bf5cc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,32 @@
+
+
+# This file is in the public domain.
+
+.PHONY: extract
+
+# Extract translateable strings from jinja2 templates.
+extract: *.html
+       pybabel extract -F babel.map index.html.j2 -o locale/messages.pot .
+
+# Update translation (.po) files with new strings.
+update: locale/messages.pot
+       msgmerge -U -m --previous locale/en/LC_MESSAGES/messages.po 
locale/messages.pot 
+       msgmerge -U -m --previous locale/de/LC_MESSAGES/messages.po 
locale/messages.pot
+       msgmerge -U -m --previous locale/fr/LC_MESSAGES/messages.po 
locale/messages.pot
+       msgmerge -U -m --previous locale/es/LC_MESSAGES/messages.po 
locale/messages.pot
+       msgmerge -U -m --previous locale/it/LC_MESSAGES/messages.po 
locale/messages.pot
+       msgmerge -U -m --previous locale/ru/LC_MESSAGES/messages.po 
locale/messages.pot
+       msgmerge -U -m --previous locale/pt/LC_MESSAGES/messages.po 
locale/messages.pot
+
+# Compile translation files for use.
+compile:
+       pybabel compile -d locale -l en --use-fuzzy
+       pybabel compile -d locale -l de --use-fuzzy
+       pybabel compile -d locale -l fr --use-fuzzy
+       pybabel compile -d locale -l it --use-fuzzy
+       pybabel compile -d locale -l es --use-fuzzy
+       pybabel compile -d locale -l ru --use-fuzzy
+       pybabel compile -d locale -l pt --use-fuzzy
+
+translate:
+       ./template.py
diff --git a/babel.map b/babel.map
new file mode 100644
index 0000000..caf6dbe
--- /dev/null
+++ b/babel.map
@@ -0,0 +1,2 @@
+[jinja2: **.j2]
+extensions=jinja2.ext.autoescape,jinja2.ext.with_
diff --git a/i18n-README b/i18n-README
new file mode 100644
index 0000000..c0e2349
--- /dev/null
+++ b/i18n-README
@@ -0,0 +1,15 @@
+Whenever new translateable content is added, follow the steps below
+in order to update the various PO files with new untranslated sections.
+
+1. Give 'make extract' to let pybabel append the new content into the POT file.
+2. Give 'make update' to join the new content as untranslated into every PO 
file.
+3. Translate your PO file.
+
+What to put under version?
+
+1. The POT file, so next invocations of 'make extract' will not try to 
re-extract what's already been extracted.
+2. The PO file so translators will find new translateable sections.
+
+After adding the translation to the PO files, just
+
+1. Put the modified PO file under version.
diff --git a/index.html b/index.html.j2
similarity index 97%
rename from index.html
rename to index.html.j2
index c83ed86..e188e77 100644
--- a/index.html
+++ b/index.html.j2
@@ -8,7 +8,7 @@
   </head>
   <body>
   <h1>GNU Taler documentation</h1>
-  This page is an overview of all documentation resources for <a 
href="https://taler.net";>GNU Taler</a>.
+  {{ _("This page is an overview of all documentation resources for") }} <a 
href="https://taler.net";>GNU Taler</a>.
 
   <h2>Components</h2>
 
diff --git a/locale/de/LC_MESSAGES/messages.po 
b/locale/de/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..d96d58a
--- /dev/null
+++ b/locale/de/LC_MESSAGES/messages.po
@@ -0,0 +1,23 @@
+# German translations for PROJECT.
+# Copyright (C) 2018 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <address@hidden>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: address@hidden"
+"POT-Creation-Date: 2018-09-24 15:09+0200\n"
+"PO-Revision-Date: 2018-09-24 14:49+0200\n"
+"Last-Translator: FULL NAME <address@hidden>\n"
+"Language-Team: de <address@hidden>\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"Generated-By: Babel 2.5.1\n"
+
+#: index.html.j2:11
+msgid "This page is an overview of all documentation resources for"
+msgstr ""
diff --git a/locale/en/LC_MESSAGES/messages.po 
b/locale/en/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..b5162fe
--- /dev/null
+++ b/locale/en/LC_MESSAGES/messages.po
@@ -0,0 +1,23 @@
+# English translations for PROJECT.
+# Copyright (C) 2018 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <address@hidden>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: address@hidden"
+"POT-Creation-Date: 2018-09-24 15:09+0200\n"
+"PO-Revision-Date: 2018-09-24 14:48+0200\n"
+"Last-Translator: FULL NAME <address@hidden>\n"
+"Language-Team: en <address@hidden>\n"
+"Language: en\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"Generated-By: Babel 2.5.1\n"
+
+#: index.html.j2:11
+msgid "This page is an overview of all documentation resources for"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/messages.po 
b/locale/es/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..0d49be3
--- /dev/null
+++ b/locale/es/LC_MESSAGES/messages.po
@@ -0,0 +1,23 @@
+# Spanish translations for PROJECT.
+# Copyright (C) 2018 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <address@hidden>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: address@hidden"
+"POT-Creation-Date: 2018-09-24 15:09+0200\n"
+"PO-Revision-Date: 2018-09-24 14:49+0200\n"
+"Last-Translator: FULL NAME <address@hidden>\n"
+"Language-Team: es <address@hidden>\n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"Generated-By: Babel 2.5.1\n"
+
+#: index.html.j2:11
+msgid "This page is an overview of all documentation resources for"
+msgstr ""
diff --git a/locale/fr/LC_MESSAGES/messages.po 
b/locale/fr/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..2bcb69e
--- /dev/null
+++ b/locale/fr/LC_MESSAGES/messages.po
@@ -0,0 +1,23 @@
+# French translations for PROJECT.
+# Copyright (C) 2018 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <address@hidden>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: address@hidden"
+"POT-Creation-Date: 2018-09-24 15:09+0200\n"
+"PO-Revision-Date: 2018-09-24 14:49+0200\n"
+"Last-Translator: FULL NAME <address@hidden>\n"
+"Language-Team: fr <address@hidden>\n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1)\n"
+"Generated-By: Babel 2.5.1\n"
+
+#: index.html.j2:11
+msgid "This page is an overview of all documentation resources for"
+msgstr ""
diff --git a/locale/it/LC_MESSAGES/messages.po 
b/locale/it/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..7da701b
--- /dev/null
+++ b/locale/it/LC_MESSAGES/messages.po
@@ -0,0 +1,23 @@
+# Italian translations for PROJECT.
+# Copyright (C) 2018 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <address@hidden>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: address@hidden"
+"POT-Creation-Date: 2018-09-24 15:09+0200\n"
+"PO-Revision-Date: 2018-09-24 14:49+0200\n"
+"Last-Translator: FULL NAME <address@hidden>\n"
+"Language-Team: it <address@hidden>\n"
+"Language: it\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"Generated-By: Babel 2.5.1\n"
+
+#: index.html.j2:11
+msgid "This page is an overview of all documentation resources for"
+msgstr "Questa pagina contiene la lista di ogni sezione documentativa di"
diff --git a/locale/messages.pot b/locale/messages.pot
new file mode 100644
index 0000000..6bed994
--- /dev/null
+++ b/locale/messages.pot
@@ -0,0 +1,23 @@
+# Translations template for PROJECT.
+# Copyright (C) 2018 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <address@hidden>, 2018.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: address@hidden"
+"POT-Creation-Date: 2018-09-24 15:09+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <address@hidden>\n"
+"Language-Team: LANGUAGE <address@hidden>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 2.5.1\n"
+
+#: index.html.j2:11
+msgid "This page is an overview of all documentation resources for"
+msgstr ""
+
diff --git a/locale/pt/LC_MESSAGES/messages.po 
b/locale/pt/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..1c04aa6
--- /dev/null
+++ b/locale/pt/LC_MESSAGES/messages.po
@@ -0,0 +1,23 @@
+# Portuguese translations for PROJECT.
+# Copyright (C) 2018 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <address@hidden>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: address@hidden"
+"POT-Creation-Date: 2018-09-24 15:09+0200\n"
+"PO-Revision-Date: 2018-09-24 14:49+0200\n"
+"Last-Translator: FULL NAME <address@hidden>\n"
+"Language-Team: pt <address@hidden>\n"
+"Language: pt\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"Generated-By: Babel 2.5.1\n"
+
+#: index.html.j2:11
+msgid "This page is an overview of all documentation resources for"
+msgstr ""
diff --git a/locale/ru/LC_MESSAGES/messages.po 
b/locale/ru/LC_MESSAGES/messages.po
new file mode 100644
index 0000000..3f4acb1
--- /dev/null
+++ b/locale/ru/LC_MESSAGES/messages.po
@@ -0,0 +1,24 @@
+# Russian translations for PROJECT.
+# Copyright (C) 2018 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <address@hidden>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: address@hidden"
+"POT-Creation-Date: 2018-09-24 15:09+0200\n"
+"PO-Revision-Date: 2018-09-24 14:49+0200\n"
+"Last-Translator: FULL NAME <address@hidden>\n"
+"Language-Team: ru <address@hidden>\n"
+"Language: ru\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
+"Generated-By: Babel 2.5.1\n"
+
+#: index.html.j2:11
+msgid "This page is an overview of all documentation resources for"
+msgstr ""
diff --git a/template.py b/template.py
new file mode 100755
index 0000000..cd122d3
--- /dev/null
+++ b/template.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+# This file is in the public domain.
+#
+# This script runs the jinja2 templating engine on an input template-file
+# using the specified locale for gettext translations, and outputs
+# the resulting (HTML) ouptut-file.
+#
+# Note that the gettext files need to be prepared first. This script
+# is thus to be invoked via the Makefile.
+import os
+import os.path
+import sys
+import re
+import gettext
+import jinja2
+import glob
+import codecs
+import os
+import os.path
+
+env = 
jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
+        extensions=["jinja2.ext.i18n"],
+        lstrip_blocks=True,
+        trim_blocks=True,
+
+        undefined=jinja2.StrictUndefined,
+                         autoescape=False)
+
+default_ctx = {}
+default_ctx["custom_link"] = os.environ.get("TALER_ENV_URL_CUSTOMLINK", "#")
+
+
+for in_file in glob.glob("*.j2"):
+    name, ext = re.match(r"(.*)\.([^.]+)$", in_file.rstrip(".j2")).groups()
+    tmpl = env.get_template(in_file)
+
+    def self_localized(other_locale):
+        """
+        Return URL for the current page in another locale.
+        """
+        return "../" + other_locale + "/" + in_file.rstrip(".j2")
+
+    def url_localized(filename):
+        return "../" + locale + "/" + filename
+
+    def url(x):
+        # TODO: look at the app root environment variable
+        # TODO: check if file exists
+        return "../" + x
+
+    for l in ("en", "de", "it", "es"):
+        locale = os.path.basename(l)
+
+        if os.path.isdir(os.path.join("./locale/", locale)):
+            tr = gettext.translation("messages",
+                                     localedir="locale",
+                                     languages=[locale])
+
+            env.install_gettext_translations(tr, newstyle=True)
+        else:
+            print("warning: locale {} not found".format(locale))
+        
+        ctx = dict(
+                lang=locale,
+                url=url,
+                self_localized=self_localized,
+                url_localized=url_localized,
+                filename=name + "." + ext)
+        ctx.update(default_ctx)
+
+        content = tmpl.render(**ctx)
+        out_name = "./" + locale + "/" + in_file.rstrip(".j2")
+        os.makedirs("./" + locale, exist_ok=True)
+
+        with codecs.open(out_name, "w", "utf-8") as f:
+            f.write(content)

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]