#!/bin/env python3
# -*- coding: utf-8 -*-
-__version__ = '1.4.1'
+__version__ = '1.4.2'
# vim: ts=4 et list
from .base_app import BaseHookError, BaseHookApp, UncriticalHookError
+from .xlate import XLATOR
+
LOG = logging.getLogger(__name__)
DEFAULT_PARENT_DIR = '/etc/puppetlabs/code/fileserver'
+_ = XLATOR.gettext
+ngettext = XLATOR.ngettext
+
# =============================================================================
class ShowModulesError(BaseHookError):
def __init__(self, output_type='json', appname=None, verbose=0, version=__version__):
"""Constructor."""
- description = textwrap.dedent('''\
- returns a list with all used Puppet modules
- ''').strip()
-
+ description = _('Returns a list with all used Puppet modules.')
self.filters = None
appname=appname, verbose=verbose, version=version, description=description,
output_type=output_type)
- self._html_title = "All Puppet modules."
+ self._html_title = _("All Puppet modules.")
# -------------------------------------------------------------------------
def as_dict(self, short=True):
try:
regex_compiled = re.compile(regex, re.IGNORECASE)
except Exception as e:
- LOG.error("{c}: Invalid regular expression {r!r}: {e}".format(
+ LOG.error(_("{c}: Invalid regular expression {r!r}: {e}").format(
c=e.__class__.__name__, r=regex, e=e))
else:
if 're' not in self.filters:
if not len(module_infos):
self.print_out()
- self.print_out('<h2>Keine passenden Module gefunden.</h2>')
+ self.print_out('<h2>' + _('No suitable modules found.') + '</h2>')
self.print_out()
return
self.print_out(' <colgroup span="9"></colgroup>')
self.print_out(' <thead>')
self.print_out(' <tr>')
- self.print_out(' <th rowspan="2" class="l h confluenceTh">Name</th>')
- self.print_out(' <th rowspan="2" class="l h confluenceTh">Vollständiger Name</th>')
- self.print_out(' <th rowspan="2" class="h confluenceTh">Repository</th>')
- self.print_out(
- ' <th rowspan="2" class="h confluenceTh">Homepage bei Puppet Forge</th>')
- self.print_out(' <th colspan="4" class="h confluenceTh">Version</th>')
- self.print_out(' <th rowspan="2" class="h confluenceTh">Letzter Check</th>')
+ self.print_out(' <th rowspan="2" class="l h confluenceTh">{}</th>'.format(
+ _('Name')))
+ self.print_out(' <th rowspan="2" class="l h confluenceTh">{}</th>'.format(
+ _('Complete Name')))
+ self.print_out(' <th rowspan="2" class="h confluenceTh">{}</th>'.format(
+ _('Repository')))
+ self.print_out(' <th rowspan="2" class="h confluenceTh">{}</th>'.format(
+ _('Homepage at Puppet Forge')))
+ self.print_out(' <th colspan="4" class="h confluenceTh">{}</th>'.format(
+ _('Version')))
+ self.print_out(' <th rowspan="2" class="h confluenceTh">{}</th>'.format(
+ _('Last Check')))
self.print_out(' </tr><tr>')
self.print_out(' <th class="h confluenceTh">Puppet Forge</th>')
self.print_out(' <th class="h confluenceTh">Development</th>')
plural_e = 'e'
if nr_modules == 1:
plural_e = ''
- msg = "<br/>Insgesamt <b>{nr} Modul{e}</b> gefunden.".format(nr=nr_modules, e=plural_e)
+ msg = "<br/>" + ngettext(
+ "Found total {sb}one module{eb}.",
+ "Found total {sb}{nr} modules{eb}.", nr_modules).format(
+ sb='<b>', nr=nr_modules, eb='</b>')
self.print_out(msg)
# -------------------------------------------------------------------------
if not module_infos:
self.print_out()
- self.print_out('Keine passenden Module gefunden.')
+ self.print_out(_('No suitable modules found.'))
self.print_out()
return
label = {
- 'name': 'Name',
- 'full_name': 'Vollständiger Name',
- 'repo': "Repository",
+ 'name': _('Name'),
+ 'full_name': _('Complete Name'),
+ 'repo': _('Repository'),
'forge_version': 'Puppet Forge',
'version_development': 'Development',
'version_test': 'Test',
'version_production': 'Production',
- 'date_checked': 'Letzter Check',
+ 'date_checked': _('Last Check'),
}
if self.verbose > 2:
plural_e = 'e'
if nr_modules == 1:
plural_e = ''
- msg = "\nInsgesamt {nr} Modul{e} gefunden:\n".format(nr=nr_modules, e=plural_e)
+ msg = "\n" + ngettext(
+ "Found total {sb}one module{eb}.",
+ "Found total {sb}{nr} modules{eb}.", nr_modules).format(
+ sb='', nr=nr_modules, eb='')
self.print_out(msg)
self.print_out()
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 11:18+0100\n"
+"POT-Creation-Date: 2018-12-28 11:49+0100\n"
"PO-Revision-Date: 2018-12-28 11:19+0100\n"
"Last-Translator: Frank Brehm <frank.brehm@pixelpark.com>\n"
"Language: de_DE\n"
#: lib/webhooks/base_app.py:873
msgid "Python CGI is running."
-msgstr "Python-CGI-Skript wird aussgeführt."
+msgstr "Python-CGI-Skript wird ausgeführt."
#: lib/webhooks/base_app.py:906 lib/webhooks/base_app.py:911
msgid "Got a {cn} performing {a}: {e}"
msgid "Could not evaluate content of {f!r}: {e}"
msgstr "Konnte den Inhalt von {f!r} nicht auswerten: {e}"
+#: lib/webhooks/show_modules.py:58
+msgid "Returns a list with all used Puppet modules."
+msgstr "Gibt eine Liste mit allen Puppet-Modulen zurück."
+
+#: lib/webhooks/show_modules.py:66
+msgid "All Puppet modules."
+msgstr "Alle Puppet-Module"
+
+#: lib/webhooks/show_modules.py:171
+msgid "{c}: Invalid regular expression {r!r}: {e}"
+msgstr "{c}: Ungültiger regulärer Ausdruck {r!r}: {e}"
+
+#: lib/webhooks/show_modules.py:229 lib/webhooks/show_modules.py:312
+msgid "No suitable modules found."
+msgstr "Keine passenden Module gefunden."
+
+#: lib/webhooks/show_modules.py:238 lib/webhooks/show_modules.py:317
+msgid "Name"
+msgstr "Name"
+
+#: lib/webhooks/show_modules.py:240 lib/webhooks/show_modules.py:318
+msgid "Complete Name"
+msgstr "Vollständiger Name"
+
+#: lib/webhooks/show_modules.py:242 lib/webhooks/show_modules.py:319
+msgid "Repository"
+msgstr "Repository"
+
+#: lib/webhooks/show_modules.py:244
+msgid "Homepage at Puppet Forge"
+msgstr "Homepage bei Puppet Forge"
+
+#: lib/webhooks/show_modules.py:246
+msgid "Version"
+msgstr "Version"
+
+#: lib/webhooks/show_modules.py:248 lib/webhooks/show_modules.py:324
+msgid "Last Check"
+msgstr "Letzte Überprüfung"
+
+#: lib/webhooks/show_modules.py:301 lib/webhooks/show_modules.py:369
+msgid "Found total {sb}one module{eb}."
+msgid_plural "Found total {sb}{nr} modules{eb}."
+msgstr[0] "Insgesamt {sb}ein Modul{eb} gefunden."
+msgstr[1] "Insgesamt {sb}{nr} Module{eb} gefunden."
+
#: lib/webhooks/xlate.py:54
msgid "Module directory: {!r}"
msgstr "Modul-Verzeichnis: {!r}"
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 11:18+0100\n"
+"POT-Creation-Date: 2018-12-28 11:49+0100\n"
"PO-Revision-Date: 2018-12-28 09:57+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en_US\n"
msgid "Could not evaluate content of {f!r}: {e}"
msgstr ""
+#: lib/webhooks/show_modules.py:58
+msgid "Returns a list with all used Puppet modules."
+msgstr ""
+
+#: lib/webhooks/show_modules.py:66
+msgid "All Puppet modules."
+msgstr ""
+
+#: lib/webhooks/show_modules.py:171
+msgid "{c}: Invalid regular expression {r!r}: {e}"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:229 lib/webhooks/show_modules.py:312
+msgid "No suitable modules found."
+msgstr ""
+
+#: lib/webhooks/show_modules.py:238 lib/webhooks/show_modules.py:317
+msgid "Name"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:240 lib/webhooks/show_modules.py:318
+msgid "Complete Name"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:242 lib/webhooks/show_modules.py:319
+msgid "Repository"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:244
+msgid "Homepage at Puppet Forge"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:246
+msgid "Version"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:248 lib/webhooks/show_modules.py:324
+msgid "Last Check"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:301 lib/webhooks/show_modules.py:369
+msgid "Found total {sb}one module{eb}."
+msgid_plural "Found total {sb}{nr} modules{eb}."
+msgstr[0] ""
+msgstr[1] ""
+
#: lib/webhooks/xlate.py:54
msgid "Module directory: {!r}"
msgstr ""
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: puppetmaster_webhooks 1.4.1\n"
+"Project-Id-Version: puppetmaster_webhooks 1.4.2\n"
"Report-Msgid-Bugs-To: frank.brehm@pixelpark.com\n"
-"POT-Creation-Date: 2018-12-28 11:18+0100\n"
+"POT-Creation-Date: 2018-12-28 11:49+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"
msgid "Could not evaluate content of {f!r}: {e}"
msgstr ""
+#: lib/webhooks/show_modules.py:58
+msgid "Returns a list with all used Puppet modules."
+msgstr ""
+
+#: lib/webhooks/show_modules.py:66
+msgid "All Puppet modules."
+msgstr ""
+
+#: lib/webhooks/show_modules.py:171
+msgid "{c}: Invalid regular expression {r!r}: {e}"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:229 lib/webhooks/show_modules.py:312
+msgid "No suitable modules found."
+msgstr ""
+
+#: lib/webhooks/show_modules.py:238 lib/webhooks/show_modules.py:317
+msgid "Name"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:240 lib/webhooks/show_modules.py:318
+msgid "Complete Name"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:242 lib/webhooks/show_modules.py:319
+msgid "Repository"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:244
+msgid "Homepage at Puppet Forge"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:246
+msgid "Version"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:248 lib/webhooks/show_modules.py:324
+msgid "Last Check"
+msgstr ""
+
+#: lib/webhooks/show_modules.py:301 lib/webhooks/show_modules.py:369
+msgid "Found total {sb}one module{eb}."
+msgid_plural "Found total {sb}{nr} modules{eb}."
+msgstr[0] ""
+msgstr[1] ""
+
#: lib/webhooks/xlate.py:54
msgid "Module directory: {!r}"
msgstr ""