summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lang/en.lua5
-rw-r--r--lib/gitano/plugins.lua18
2 files changed, 15 insertions, 8 deletions
diff --git a/lang/en.lua b/lang/en.lua
index 5af0b66..9610394 100644
--- a/lang/en.lua
+++ b/lang/en.lua
@@ -162,4 +162,9 @@ example administration repository rules and an admin user and group.
ERROR_UNEXPECTED_ADDITIONAL_ARGUMENT = "Unexpected additional argument",
ERROR_MISSING_MATCHTYPE_OR_VALUE = "Missing match type or value",
ERROR_UNKNOWN_MATCHTYPE = "Unknown match type",
+
+ -- Messages from the plugin module
+ WARN_UNABLE_SCAN_PLUGINDIR = "Unable to scan plugin directory '${dir}': ${reason}",
+ WARN_UNABLE_LOAD_PLUGIN = "Failure loading plugin '${plugin}' from '${file}': ${reason}",
+ WARN_UNABLE_RUN_PLUGIN = "Failure running plugin '${plugin}' from '${file}': ${reason}",
}
diff --git a/lib/gitano/plugins.lua b/lib/gitano/plugins.lua
index e444eea..57f73c3 100644
--- a/lib/gitano/plugins.lua
+++ b/lib/gitano/plugins.lua
@@ -20,8 +20,8 @@ local function find_plugins(path)
for _, entry in ipairs(path) do
local dirp, err = sio.opendir(entry)
if not dirp then
- log.warning(("Unable to scan plugin directory '%s': %s")
- :format(entry, err))
+ log.warning(i18n.expand("WARN_UNABLE_SCAN_PLUGINDIR",
+ {dir=entry, reason=err}))
else
for filename, fileinfo in dirp:iterate() do
local plugin_name = filename:match(plugin_name_pattern)
@@ -45,15 +45,17 @@ local function load_plugins(path)
plugin_name .. ".lua")
local chunk, err = loadfile(filepath)
if not chunk then
- log.warning(("Failure loading plugin '%s' from '%s': %s")
- :format(plugin_name, to_load[plugin_name],
- err))
+ log.warning(i18n.expand("WARN_UNABLE_LOAD_PLUGIN",
+ { plugin=plugin_name,
+ file=to_load[plugin_name],
+ reason=err }))
else
local ok, err = pcall(chunk)
if not ok then
- log.warning(("Failure running plugin '%s' from '%s': %s")
- :format(plugin_name, to_load[plugin_name],
- err))
+ log.warning(i18n.expand("WARN_UNABLE_RUN_PLUGIN",
+ { plugin=plugin_name,
+ file=to_load[plugin_name],
+ reason=err }))
end
end
i18n.add_plugin_path(util.path_join(to_load[plugin_name],