From: Frank Brehm Date: Fri, 28 Dec 2018 09:03:11 +0000 (+0100) Subject: Adding i18n files and helper scripts X-Git-Tag: 1.6.4^2~99 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=2e5ab143a8506ff9db221abe4ee0638dc0d3a8a5;p=pixelpark%2Fpuppetmaster-webhooks.git Adding i18n files and helper scripts --- diff --git a/.gitignore b/.gitignore index d1efc30..4001178 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ .orig +*.mo + # editor temp files *~ .*.sw? diff --git a/babel.ini b/babel.ini new file mode 100644 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 index 0000000..29147d4 --- /dev/null +++ b/compile-xlate-msgs.sh @@ -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 index 0000000..9ea966c --- /dev/null +++ b/locale/de_DE/LC_MESSAGES/puppetmaster_webhooks.po @@ -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 , 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 \n" +"Language: de_DE\n" +"Language-Team: de_DE \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 index 0000000..64679d0 --- /dev/null +++ b/locale/en_US/LC_MESSAGES/puppetmaster_webhooks.po @@ -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 , 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 \n" +"Language: en_US\n" +"Language-Team: en_US \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 index 0000000..09e0f3d --- /dev/null +++ b/locale/puppetmaster_webhooks.pot @@ -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 , 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 \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.6.0\n" + diff --git a/xtract-xlate-msgs.sh b/xtract-xlate-msgs.sh new file mode 100755 index 0000000..d07a2a2 --- /dev/null +++ b/xtract-xlate-msgs.sh @@ -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