summaryrefslogtreecommitdiff
path: root/portato/plugin.py
diff options
context:
space:
mode:
authornecoro <>2007-08-05 04:11:46 +0000
committernecoro <>2007-08-05 04:11:46 +0000
commit8fe46a012d17eaa874abf63b9be93c6f11b8df97 (patch)
tree517e994fa610586e83d297997a4865f7b3b86af4 /portato/plugin.py
parent0087f656a2d9fe962d874ae73f5759dbfc09f634 (diff)
downloadportato-8fe46a012d17eaa874abf63b9be93c6f11b8df97.tar.gz
portato-8fe46a012d17eaa874abf63b9be93c6f11b8df97.tar.bz2
portato-8fe46a012d17eaa874abf63b9be93c6f11b8df97.zip
i18n support and german translations
Diffstat (limited to '')
-rw-r--r--portato/plugin.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/portato/plugin.py b/portato/plugin.py
index ea11c3a..3b065b9 100644
--- a/portato/plugin.py
+++ b/portato/plugin.py
@@ -15,6 +15,7 @@
import os, os.path
from xml.dom.minidom import parse
from lxml import etree
+from gettext import lgettext as _
from constants import PLUGIN_DIR, XSD_LOCATION
from helper import *
@@ -283,18 +284,18 @@ class PluginQueue:
try:
mod = __import__(imp, globals(), locals(), [cmd.hook.call])
except ImportError:
- error("%s cannot be imported.", imp)
+ error(_("%s cannot be imported."), imp)
return
try:
f = eval("mod."+cmd.hook.call) # build function
except AttributeError:
- error("%s cannot be imported.", cmd.hook.call)
+ error(_("%s cannot be imported."), cmd.hook.call)
else:
try:
f = eval(cmd.hook.call)
except AttributeError:
- error("%s cannot be imported", cmd.hook.call)
+ error(_("%s cannot be imported."), cmd.hook.call)
return f(*hargs, **hkwargs) # call function
@@ -321,18 +322,18 @@ class PluginQueue:
# before
for cmd in list[0]:
- debug("Accessing hook '%s' of plugin '%s' (before).", hook, cmd.hook.plugin.name)
+ debug(_("Accessing hook '%(hook)s' of plugin '%(plugin)s' (before)."), {"hook" : hook, "plugin": cmd.hook.plugin.name})
call(cmd)
if list[1]: # override
- info("Overriding hook '%s' with plugin '%s'.", hook, list[1][0].hook.plugin.name)
+ info(_("Overriding hook '%(hook)s' with plugin '%(plugin)s'."), {"hook": hook, "plugin": list[1][0].hook.plugin.name})
ret = call(list[1][0])
else: # normal
ret = func(*args, **kwargs)
# after
for cmd in list[2]:
- debug("Accessing hook '%s' of plugin '%s' (after).", hook, cmd.hook.plugin.name)
+ debug(_("Accessing hook '%(hook)s' of plugin '%(plugin)s' (after)."), {"hook":hook, "plugin": cmd.hook.plugin.name})
call(cmd)
return ret
@@ -352,10 +353,10 @@ class PluginQueue:
try:
schema.assertValid(etree.parse(p))
except etree.XMLSyntaxError:
- error("Loading plugin '%s' failed. Invalid XML syntax.", p)
+ error(_("Loading plugin '%s' failed. Invalid XML syntax."), p)
continue
except etree.DocumentInvalid:
- error("Loading plugin '%s' failed. Plugin does not comply with schema.", p)
+ error(_("Loading plugin '%s' failed. Plugin does not comply with schema."), p)
continue
doc = parse(p)
@@ -384,10 +385,10 @@ class PluginQueue:
plugin.parse_options(elem.getElementsByTagName("options"))
self.list.append(plugin)
- info("Plugin '%s' loaded.", p)
+ info(_("Plugin '%s' loaded."), p)
except PluginImportException, e:
- error("Loading plugin '%s' failed: Could not import %s", p, e[0])
+ error(_("Loading plugin '%(plugin)s' failed: Could not import %(import)s"), {"plugin": p, "import": e[0]})
finally:
doc.unlink()
@@ -452,7 +453,7 @@ class PluginQueue:
# type = "override"
elif connect.is_override_type():
if self.hooks[hook.hook][1]:
- warn("For hook '%s' an override is already defined by plugin '%s'!", hook.hook, self.hooks[hook.hook][1][0])
+ warn(_("For hook '%(hook)s' an override is already defined by plugin '%(plugin)s'!"), {"hook": hook.hook, "plugin": self.hooks[hook.hook][1][0]})
self.hooks[hook.hook][1][:1] = [connect]
continue
@@ -483,7 +484,7 @@ class PluginQueue:
resolve(hook, list, idx, add)
for l in list:
- warn("Command for hook '%s' in plugin '%s' could not be added due to missing dependant: '%s'!", hook, l.hook.plugin.name, l.depend_plugin)
+ warn("Command for hook '%(hook)s' in plugin '%(plugin)s' could not be added due to missing dependant: '%(dep)s'!", {"hook": hook, "plugin": l.hook.plugin.name, "dep": l.depend_plugin})
for hook in before:
resolve(hook, before[hook], 0, 0)
9b176aeb0bc4ed35be2&follow=1'>Add submodule links in tree listingLars Hjemli6-12/+27 2007-05-11Add submodules.sh and use it during buildsLars Hjemli3-13/+222 2007-05-11Added git as a submoduleLars Hjemli2-1/+1 2007-05-09Add support for downloading single blobsLars Hjemli5-3/+47 2007-05-08ui-view: show pathname if specified in querystringLars Hjemli3-5/+10 2007-05-08Update to libgit 1.5.2-rc2Lars Hjemli9-837/+50 2007-02-21Layout updateLars Hjemli9-32/+127 2007-02-08Make snapshot feature configurableLars Hjemli5-6/+22 2007-02-08Add support for snapshotsLars Hjemli8-8/+153 2007-02-05cgit v0.2v0.2Lars Hjemli1-1/+1 2007-02-05Add support for prefix and gitsrc arguments to 'make'Lars Hjemli2-15/+37 2007-02-04Update cgitrc templateLars Hjemli1-21/+32 2007-02-04Add support for lightweight tagsLars Hjemli2-19/+37 2007-02-04Read repo-info from /etc/cgitrcLars Hjemli5-55/+120 2007-02-04Do not die if tag has no messageLars Hjemli1-2/+2 2007-02-03Fix search for non-virtual urlsLars Hjemli1-0/+6 2007-01-28Update README with install/config informationLars Hjemli1-24/+28