]> Frank Brehm's Git Trees - pixelpark/puppetmaster-webhooks.git/commitdiff
Adding i18n files and helper scripts
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 28 Dec 2018 09:03:11 +0000 (10:03 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 28 Dec 2018 09:03:11 +0000 (10:03 +0100)
.gitignore
babel.ini [new file with mode: 0644]
compile-xlate-msgs.sh [new file with mode: 0755]
locale/de_DE/LC_MESSAGES/puppetmaster_webhooks.po [new file with mode: 0644]
locale/en_US/LC_MESSAGES/puppetmaster_webhooks.po [new file with mode: 0644]
locale/puppetmaster_webhooks.pot [new file with mode: 0644]
xtract-xlate-msgs.sh [new file with mode: 0755]

index d1efc30410967aa4d5350b944bc67eb0b9d3360a..400117898220b3cab0dc4a66ff842ad9742de5c4 100644 (file)
@@ -11,6 +11,8 @@
 
 .orig
 
+*.mo
+
 # editor temp files
 *~
 .*.sw?
diff --git a/babel.ini b/babel.ini
new file mode 100644 (file)
index 0000000..d7dfdfd
--- /dev/null
+++ b/babel.ini
@@ -0,0 +1,5 @@
+# Extraction from Python source files
+[python: **.py]
+
+[python: bin/*]
+
diff --git a/compile-xlate-msgs.sh b/compile-xlate-msgs.sh
new file mode 100755 (executable)
index 0000000..29147d4
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -e
+set -u
+
+base_dir=$( dirname $0 )
+cd ${base_dir}
+
+locale_dir=locale
+locale_domain="puppetmaster_webhooks"
+pot_file="${locale_dir}/${locale_domain}.pot"
+po_with=99
+my_address="${DEBEMAIL:-frank.brehm@pixelpark.com}"
+
+pybabel compile --domain "${locale_domain}" \
+    --directory "${locale_dir}" \
+    --statistics
+
diff --git a/locale/de_DE/LC_MESSAGES/puppetmaster_webhooks.po b/locale/de_DE/LC_MESSAGES/puppetmaster_webhooks.po
new file mode 100644 (file)
index 0000000..9ea966c
--- /dev/null
@@ -0,0 +1,20 @@
+# German (Germany) translations for puppetmaster_webhooks.
+# Copyright (C) 2018 Frank Brehm, Pixelpark GmbH, Berlin
+# This file is distributed under the same license as the puppetmaster_webhooks project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: puppetmaster_webhooks 1.3.1\n"
+"Report-Msgid-Bugs-To: frank.brehm@pixelpark.com\n"
+"POT-Creation-Date: 2018-12-28 09:57+0100\n"
+"PO-Revision-Date: 2018-12-28 09:57+0100\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language: de_DE\n"
+"Language-Team: de_DE <LL@li.org>\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 2.6.0\n"
+
diff --git a/locale/en_US/LC_MESSAGES/puppetmaster_webhooks.po b/locale/en_US/LC_MESSAGES/puppetmaster_webhooks.po
new file mode 100644 (file)
index 0000000..64679d0
--- /dev/null
@@ -0,0 +1,20 @@
+# English (United States) translations for puppetmaster_webhooks.
+# Copyright (C) 2018 Frank Brehm, Pixelpark GmbH, Berlin
+# This file is distributed under the same license as the puppetmaster_webhooks project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2018.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: puppetmaster_webhooks 1.3.1\n"
+"Report-Msgid-Bugs-To: frank.brehm@pixelpark.com\n"
+"POT-Creation-Date: 2018-12-28 09:57+0100\n"
+"PO-Revision-Date: 2018-12-28 09:57+0100\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language: en_US\n"
+"Language-Team: en_US <LL@li.org>\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 2.6.0\n"
+
diff --git a/locale/puppetmaster_webhooks.pot b/locale/puppetmaster_webhooks.pot
new file mode 100644 (file)
index 0000000..09e0f3d
--- /dev/null
@@ -0,0 +1,19 @@
+# Translations template for puppetmaster_webhooks.
+# Copyright (C) 2018 Frank Brehm, Pixelpark GmbH, Berlin
+# This file is distributed under the same license as the puppetmaster_webhooks project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2018.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: puppetmaster_webhooks 1.3.1\n"
+"Report-Msgid-Bugs-To: frank.brehm@pixelpark.com\n"
+"POT-Creation-Date: 2018-12-28 09:57+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.6.0\n"
+
diff --git a/xtract-xlate-msgs.sh b/xtract-xlate-msgs.sh
new file mode 100755 (executable)
index 0000000..d07a2a2
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+set -e
+set -u
+
+base_dir=$( dirname $0 )
+cd ${base_dir}
+
+locale_dir=locale
+locale_domain="puppetmaster_webhooks"
+pot_file="${locale_dir}/${locale_domain}.pot"
+po_with=99
+my_address="${DEBEMAIL:-frank.brehm@pixelpark.com}"
+
+pkg_version=$( cat lib/webhooks/__init__.py | \
+                    grep '^[   ]*__version__' | \
+                    sed -e 's/[        ]*//g' | \
+                    awk -F= '{print $2}' | \
+                    sed -e "s/^'//" -e "s/'\$//" )
+
+mkdir -pv "${locale_dir}"
+
+pybabel extract *.py lib \
+    -o "${pot_file}" \
+    -F babel.ini \
+    --width=${po_with} \
+    --sort-by-file \
+    --msgid-bugs-address="${my_address}" \
+    --copyright-holder="Frank Brehm, Pixelpark GmbH, Berlin" \
+    --project="${locale_domain}" \
+    --version="${pkg_version}"
+
+for lang in de_DE en_US ; do
+    if [[ ! -f "${locale_dir}/${lang}/LC_MESSAGES/${locale_domain}.po" ]] ; then
+        pybabel init --domain "${locale_domain}" \
+            --input-file "${pot_file}" \
+            --output-dir "${locale_dir}" \
+            --locale "${lang}" \
+            --width ${po_with}
+    else
+        pybabel update --domain "${locale_domain}" \
+            --input-file "${pot_file}" \
+            --output-dir "${locale_dir}" \
+            --locale "${lang}" \
+            --width ${po_with} \
+            --ignore-obsolete \
+            --update-header-comment
+    fi
+done