From 0b56957297167538addd330e699e2e3cd2731d68 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 26 Dec 2017 22:13:52 +0100 Subject: compat: use gettext convention for tr() --- api/plugin-api.cpp | 6 +++++- api/plugin-api.hpp | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'api') diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp index eed377b0..6820ff2c 100644 --- a/api/plugin-api.cpp +++ b/api/plugin-api.cpp @@ -1,4 +1,5 @@ #include "plugin-api.hpp" +#include "compat/macros.hpp" using namespace plugin_api::detail; @@ -66,4 +67,7 @@ module_status::module_status(const QString& error) : error(error) {} module_status module_status_mixin::status_ok() { return module_status(); } -module_status module_status_mixin::error(const QString& error) { return module_status(error); } +module_status module_status_mixin::error(const QString& error) +{ + return module_status(error.isEmpty() ? QString(_("Unknown error")) : error); +} diff --git a/api/plugin-api.hpp b/api/plugin-api.hpp index 48a1f408..4a797f73 100644 --- a/api/plugin-api.hpp +++ b/api/plugin-api.hpp @@ -90,12 +90,15 @@ struct OTR_API_EXPORT module_status final module_status(const QString& error = QString()); }; +/* + * implement in all module types + */ struct OTR_API_EXPORT module_status_mixin { - static module_status status_ok(); - static module_status error(const QString& error); + static module_status status_ok(); // return from initialize() if ok + static module_status error(const QString& error); // return error message on init failure - virtual module_status initialize() = 0; + virtual module_status initialize() = 0; // where to return from }; // implement this in filters -- cgit v1.2.3