*.egg
*-stamp
*.bak
+*.mo
tmp/*
venv/*
etc/*.ini
--- /dev/null
+# Extraction from Python source files
+[python: **.py]
+
+[python: bin/*]
+
--- /dev/null
+#!/bin/bash
+
+set -e
+set -u
+
+base_dir=$( dirname $0 )
+cd ${base_dir}
+
+locale_dir=locale
+locale_domain="create_vm_template"
+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
+
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+@author: Frank Brehm
+@contact: frank.brehm@pixelpark.com
+@copyright: © 2019 by Frank Brehm, Berlin
+@summary: The module for i18n.
+ It provides translation object, usable from all other
+ modules in this package.
+"""
+from __future__ import absolute_import, print_function
+
+# Standard modules
+import logging
+import gettext
+
+from pathlib import Path
+
+# Third party modules
+from babel.support import Translations
+
+DOMAIN = 'create_vm_template'
+
+LOG = logging.getLogger(__name__)
+
+__version__ = '1.0.1'
+
+__me__ = Path(__file__).resolve()
+__module_dir__ = __me__.parent
+__lib_dir__ = __module_dir__.parent
+__base_dir__ = __lib_dir__.parent
+LOCALE_DIR = __base_dir__.joinpath('locale')
+if not LOCALE_DIR.is_dir():
+ LOCALE_DIR = __module_dir__.joinpath('locale')
+ if not LOCALE_DIR.is_dir():
+ LOCALE_DIR = None
+
+__mo_file__ = gettext.find(DOMAIN, str(LOCALE_DIR))
+if __mo_file__:
+ try:
+ with open(__mo_file__, 'rb') as F:
+ XLATOR = Translations(F, DOMAIN)
+ except IOError:
+ XLATOR = gettext.NullTranslations()
+else:
+ XLATOR = gettext.NullTranslations()
+
+_ = XLATOR.gettext
+
+# =============================================================================
+
+if __name__ == "__main__":
+
+ print(_("Module directory: {!r}").format(__module_dir__))
+ print(_("Base directory: {!r}").format(__base_dir__))
+ print(_("Locale directory: {!r}").format(LOCALE_DIR))
+ print(_("Locale domain: {!r}").format(DOMAIN))
+ print(_("Found .mo-file: {!r}").format(__mo_file__))
+
+# =============================================================================
+
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
--- /dev/null
+# Translations template for create_vm_template.
+# Copyright (C) 2019 Frank Brehm, Pixelpark GmbH, Berlin
+# This file is distributed under the same license as the create_vm_template project.
+# Frank Brehm <frank.brehm@pixelpark.com>, 2019.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: create_vm_template 1.0.0\n"
+"Report-Msgid-Bugs-To: frank.brehm@pixelpark.com\n"
+"POT-Creation-Date: 2019-02-08 09:56+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <frank.brehm@pixelpark.com>\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"
+
+#: lib/cr_vmware_tpl/xlate.py:54
+msgid "Module directory: {!r}"
+msgstr ""
+
+#: lib/cr_vmware_tpl/xlate.py:55
+msgid "Base directory: {!r}"
+msgstr ""
+
+#: lib/cr_vmware_tpl/xlate.py:56
+msgid "Locale directory: {!r}"
+msgstr ""
+
+#: lib/cr_vmware_tpl/xlate.py:57
+msgid "Locale domain: {!r}"
+msgstr ""
+
+#: lib/cr_vmware_tpl/xlate.py:58
+msgid "Found .mo-file: {!r}"
+msgstr ""
+
--- /dev/null
+# German (Germany) translations for create_vm_template.
+# Copyright (C) 2019 Frank Brehm, Pixelpark GmbH, Berlin
+# This file is distributed under the same license as the create_vm_template project.
+# Frank Brehm <frank.brehm@pixelpark.com>, 2019.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: create_vm_template 1.0.0\n"
+"Report-Msgid-Bugs-To: frank.brehm@pixelpark.com\n"
+"POT-Creation-Date: 2019-02-08 09:56+0100\n"
+"PO-Revision-Date: 2019-02-08 09:56+0100\n"
+"Last-Translator: Frank Brehm <frank.brehm@pixelpark.com>\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"
+
+#: lib/cr_vmware_tpl/xlate.py:54
+msgid "Module directory: {!r}"
+msgstr "Modul-Verzeichnis: {!r}"
+
+#: lib/cr_vmware_tpl/xlate.py:55
+msgid "Base directory: {!r}"
+msgstr "Basis-Verzeichnis: {!r}"
+
+#: lib/cr_vmware_tpl/xlate.py:56
+msgid "Locale directory: {!r}"
+msgstr "Verzeichnis für Locales: {!r}"
+
+#: lib/cr_vmware_tpl/xlate.py:57
+msgid "Locale domain: {!r}"
+msgstr "Locale-Domäne: {!r}"
+
+#: lib/cr_vmware_tpl/xlate.py:58
+msgid "Found .mo-file: {!r}"
+msgstr "Gefundene .mo-Datei: {!r}"
+
--- /dev/null
+# English (United States) translations for create_vm_template.
+# Copyright (C) 2019 Frank Brehm, Pixelpark GmbH, Berlin
+# This file is distributed under the same license as the create_vm_template project.
+# Frank Brehm <frank.brehm@pixelpark.com>, 2019.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: create_vm_template 1.0.0\n"
+"Report-Msgid-Bugs-To: frank.brehm@pixelpark.com\n"
+"POT-Creation-Date: 2019-02-08 09:56+0100\n"
+"PO-Revision-Date: 2019-02-08 09:56+0100\n"
+"Last-Translator: FULL NAME <frank.brehm@pixelpark.com>\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"
+
+#: lib/cr_vmware_tpl/xlate.py:54
+msgid "Module directory: {!r}"
+msgstr ""
+
+#: lib/cr_vmware_tpl/xlate.py:55
+msgid "Base directory: {!r}"
+msgstr ""
+
+#: lib/cr_vmware_tpl/xlate.py:56
+msgid "Locale directory: {!r}"
+msgstr ""
+
+#: lib/cr_vmware_tpl/xlate.py:57
+msgid "Locale domain: {!r}"
+msgstr ""
+
+#: lib/cr_vmware_tpl/xlate.py:58
+msgid "Found .mo-file: {!r}"
+msgstr ""
+
--- /dev/null
+#!/bin/bash
+
+set -e
+set -u
+
+base_dir=$( dirname $0 )
+cd ${base_dir}
+
+locale_dir=locale
+locale_domain="create_vm_template"
+pot_file="${locale_dir}/${locale_domain}.pot"
+po_with=99
+my_address="${DEBEMAIL:-frank.brehm@pixelpark.com}"
+
+pkg_version=$( cat lib/cr_vmware_tpl/__init__.py | \
+ grep '^[ ]*__version__' | \
+ sed -e 's/[ ]*//g' | \
+ awk -F= '{print $2}' | \
+ sed -e "s/^'//" -e "s/'\$//" )
+
+mkdir -pv "${locale_dir}"
+
+pybabel extract lib/cr_vmware_tpl \
+ -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}"
+
+sed -i -e "s/FIRST AUTHOR/Frank Brehm/g" -e "s/<EMAIL@ADDRESS>/<${my_address}>/g" "${pot_file}"
+
+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} \
+ --update-header-comment
+ fi
+ # --ignore-obsolete \
+done