summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovs@redhat.com>2009-09-02 11:39:27 +0200
committerNikola Pajkovsky <npajkovs@redhat.com>2009-09-02 11:39:27 +0200
commit84ae8a43927b479a8b3565e43d0b3a109b164c21 (patch)
tree80a7bed6a04fdb9628b0b039b72050bc6175b712 /lib
parent6f27b31e64229bf15670b48a19b0348888b0ca28 (diff)
downloadabrt-84ae8a43927b479a8b3565e43d0b3a109b164c21.tar.gz
abrt-84ae8a43927b479a8b3565e43d0b3a109b164c21.tar.xz
abrt-84ae8a43927b479a8b3565e43d0b3a109b164c21.zip
add gettext support for all plugins
Diffstat (limited to 'lib')
-rw-r--r--lib/MiddleWare/Plugin.h11
-rw-r--r--lib/Plugins/Bugzilla.cpp18
-rw-r--r--lib/Plugins/CCpp.cpp12
-rw-r--r--lib/Plugins/FileTransfer.cpp21
-rw-r--r--lib/Plugins/Kerneloops.cpp2
-rw-r--r--lib/Plugins/KerneloopsReporter.cpp2
-rw-r--r--lib/Plugins/KerneloopsScanner.cpp2
-rw-r--r--lib/Plugins/Logger.cpp2
-rw-r--r--lib/Plugins/Mailx.cpp4
-rw-r--r--lib/Plugins/RunApp.cpp2
-rw-r--r--lib/Plugins/SOSreport.cpp2
11 files changed, 47 insertions, 31 deletions
diff --git a/lib/MiddleWare/Plugin.h b/lib/MiddleWare/Plugin.h
index f3533a1e..39290231 100644
--- a/lib/MiddleWare/Plugin.h
+++ b/lib/MiddleWare/Plugin.h
@@ -31,6 +31,17 @@
#define PLUGINS_LIB_EXTENSION "so"
#define PLUGINS_LIB_PREFIX "lib"
+#if HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
+#if ENABLE_NLS
+ #include <libintl.h>
+ #define _(S) gettext(S)
+#else
+ #define _(S) (S)
+#endif
+
/**
* An abstract class. The class defines a common plugin interface. If a plugin
* has some settings, then a *Settings(*) method has to be written.
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index f2fb13a5..f1e90eac 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -215,7 +215,7 @@ std::string CReporterBugzilla::CheckUUIDInBugzilla(const std::string& pComponent
ss << xmlrpc_c::value_int(bug["bug_id"]);
log("Bug is already reported: %s", ss.str().c_str());
- update_client("Bug is already reported: " + ss.str());
+ update_client(_("Bug is already reported: ") + ss.str());
if (!CheckCCAndReporter(ss.str()))
{
@@ -274,8 +274,10 @@ void CReporterBugzilla::CreateNewBugDescription(const map_crash_report_t& pCrash
}
else if (it->second[CD_TYPE] == CD_BIN)
{
- warn_client("Binary file "+it->first+" will not be reported.");
- update_client("Binary file "+it->first+" will not be reported.");
+ char buffer[1024];
+ snprintf(buffer, 1024, _("Binary file %s will not be reported."), it->first.c_str());
+ warn_client(std::string(buffer));
+ //update_client(_("Binary file ")+it->first+_(" will not be reported."));
}
}
}
@@ -343,7 +345,7 @@ std::string CReporterBugzilla::NewBug(const map_crash_report_t& pCrashReport)
ret = xmlrpc_c::value_struct(rpc->getResult());
bugId << xmlrpc_c::value_int(ret["id"]);
log("New bug id: %s", bugId.str().c_str());
- update_client("New bug id: " + bugId.str());
+ update_client(_("New bug id: ") + bugId.str());
}
catch (std::exception& e)
{
@@ -404,20 +406,20 @@ std::string CReporterBugzilla::Report(const map_crash_report_t& pCrashReport, co
std::string component = pCrashReport.find(FILENAME_COMPONENT)->second[CD_CONTENT];
std::string uuid = pCrashReport.find(CD_UUID)->second[CD_CONTENT];
std::string bugId;
- update_client("Logging into bugzilla...");
+ update_client(_("Logging into bugzilla..."));
NewXMLRPCClient();
try
{
Login();
- update_client("Checking for duplicates...");
+ update_client(_("Checking for duplicates..."));
if ((bugId = CheckUUIDInBugzilla(component, uuid)) == "")
{
- update_client("Creating new bug...");
+ update_client(_("Creating new bug..."));
bugId = NewBug(pCrashReport);
AddAttachments(bugId, pCrashReport);
}
- update_client("Logging out...");
+ update_client(_("Logging out..."));
Logout();
}
catch (CABRTException& e)
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index 9b10c752..b6e47a07 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -79,7 +79,7 @@ static std::string CreateHash(const std::string& pInput)
static void InstallDebugInfos(const std::string& pPackage)
{
- update_client("Searching for debug-info packages...");
+ update_client(_("Searching for debug-info packages..."));
std::string packageName = pPackage.substr(0, pPackage.rfind("-", pPackage.rfind("-")-1));
char buff[1024];
@@ -117,7 +117,7 @@ static void InstallDebugInfos(const std::string& pPackage)
safe_write(pipein[1], "y\n", sizeof("y\n")-1);
close(pipein[1]);
- update_client("Downloading and installing debug-info packages...");
+ update_client(_("Downloading and installing debug-info packages..."));
FILE *pipeout_fp = fdopen(pipeout[0], "r");
if (pipeout_fp == NULL) /* never happens */
@@ -177,7 +177,7 @@ static void InstallDebugInfos(const std::string& pPackage)
static void GetBacktrace(const std::string& pDebugDumpDir, std::string& pBacktrace)
{
- update_client("Getting backtrace...");
+ update_client(_("Getting backtrace..."));
std::string tmpFile = "/tmp/" + pDebugDumpDir.substr(pDebugDumpDir.rfind("/"));
std::ofstream fTmp;
@@ -426,7 +426,7 @@ I think the below code has absolutely the same effect:
std::string CAnalyzerCCpp::GetLocalUUID(const std::string& pDebugDumpDir)
{
- update_client("Getting local universal unique identification...");
+ update_client(_("Getting local universal unique identification..."));
CDebugDump dd;
std::string UID;
@@ -450,7 +450,7 @@ std::string CAnalyzerCCpp::GetLocalUUID(const std::string& pDebugDumpDir)
std::string CAnalyzerCCpp::GetGlobalUUID(const std::string& pDebugDumpDir)
{
- update_client("Getting global universal unique identification...");
+ update_client(_("Getting global universal unique identification..."));
std::string backtrace;
std::string executable;
@@ -468,7 +468,7 @@ std::string CAnalyzerCCpp::GetGlobalUUID(const std::string& pDebugDumpDir)
void CAnalyzerCCpp::CreateReport(const std::string& pDebugDumpDir)
{
- update_client("Starting report creation...");
+ update_client(_("Starting report creation..."));
std::string package;
std::string backtrace;
diff --git a/lib/Plugins/FileTransfer.cpp b/lib/Plugins/FileTransfer.cpp
index 76dbb07c..9e2ee1a4 100644
--- a/lib/Plugins/FileTransfer.cpp
+++ b/lib/Plugins/FileTransfer.cpp
@@ -49,7 +49,8 @@ void CFileTransfer::SendFile(const std::string& pURL,
if (pURL == "")
{
- warn_client("FileTransfer: URL not specified");
+ warn_client(_("FileTransfer: URL not specified"));
+
return;
}
protocol = "";
@@ -64,7 +65,9 @@ void CFileTransfer::SendFile(const std::string& pURL,
}
}
- update_client("Sending archive " + pFilename + " via " + protocol);
+ char buffer[1024];
+ snprintf(buffer, 1024, _("Sending archive %s via %s"), pFilename.c_str(), protocol.c_str());
+ update_client(std::string(buffer));
if( pURL[len-1] == '/' )
{
@@ -115,7 +118,7 @@ void CFileTransfer::CreateArchive(const std::string& pArchiveName,
std::string cmdline;
int result;
- update_client("Creating an archive...");
+ update_client(_("Creating an archive..."));
/*TODO: consider library for archive creation, if there is any*/
@@ -170,7 +173,7 @@ void CFileTransfer::Run(const std::string& pActiveDir, const std::string& pArgs)
std::string dirname, archivename;
char hostname[HBLEN];
- update_client("File Transfer: Creating a report...");
+ update_client(_("File Transfer: Creating a report..."));
if (pArgs == "store")
{
@@ -191,8 +194,8 @@ void CFileTransfer::Run(const std::string& pActiveDir, const std::string& pArgs)
}
catch (CABRTException& e)
{
- warn_client("CFileTransfer::Run(): Cannot create and send an archive: " + e.what());
- update_client("CFileTransfer::Run(): Cannot create and send an archive: " + e.what());
+ warn_client(_("CFileTransfer::Run(): Cannot create and send an archive: ") + e.what());
+ //update_client("CFileTransfer::Run(): Cannot create and send an archive: " + e.what());
}
unlink(archivename.c_str());
}
@@ -220,8 +223,8 @@ void CFileTransfer::Run(const std::string& pActiveDir, const std::string& pArgs)
}
catch (CABRTException& e)
{
- warn_client("CFileTransfer::Run(): Cannot create and send an archive: " + e.what());
- update_client("CFileTransfer::Run(): Cannot create and send an archive: " + e.what());
+ warn_client(_("CFileTransfer::Run(): Cannot create and send an archive: ") + e.what());
+// update_client("CFileTransfer::Run(): Cannot create and send an archive: " + e.what());
}
unlink(archivename.c_str());
}
@@ -241,7 +244,7 @@ void CFileTransfer::SetSettings(const map_plugin_settings_t& pSettings)
}
else
{
- warn_client("FileTransfer: URL not specified");
+ warn_client(_("FileTransfer: URL not specified"));
}
if (pSettings.find("RetryCount") != pSettings.end())
diff --git a/lib/Plugins/Kerneloops.cpp b/lib/Plugins/Kerneloops.cpp
index ed27eb4e..8e34392b 100644
--- a/lib/Plugins/Kerneloops.cpp
+++ b/lib/Plugins/Kerneloops.cpp
@@ -35,7 +35,7 @@
std::string CAnalyzerKerneloops::GetLocalUUID(const std::string& pDebugDumpDir)
{
- update_client("Getting local/global universal unique identification...");
+ update_client(_("Getting local/global universal unique identification..."));
std::string m_sOops;
std::stringstream m_sHash;
diff --git a/lib/Plugins/KerneloopsReporter.cpp b/lib/Plugins/KerneloopsReporter.cpp
index b3d63321..4dced9e3 100644
--- a/lib/Plugins/KerneloopsReporter.cpp
+++ b/lib/Plugins/KerneloopsReporter.cpp
@@ -98,7 +98,7 @@ std::string CKerneloopsReporter::Report(const map_crash_report_t& pCrashReport,
int ret = -1;
map_crash_report_t::const_iterator it;
- update_client("Creating and submitting a report...");
+ update_client(_("Creating and submitting a report..."));
it = pCrashReport.begin();
it = pCrashReport.find(FILENAME_KERNELOOPS);
diff --git a/lib/Plugins/KerneloopsScanner.cpp b/lib/Plugins/KerneloopsScanner.cpp
index 3915b831..63460ba0 100644
--- a/lib/Plugins/KerneloopsScanner.cpp
+++ b/lib/Plugins/KerneloopsScanner.cpp
@@ -76,7 +76,7 @@ void CKerneloopsScanner::Run(const std::string& pActionDir,
void CKerneloopsScanner::SaveOopsToDebugDump()
{
- update_client("Creating kernel oops crash reports...");
+ update_client(_("Creating kernel oops crash reports..."));
time_t t = time(NULL);
CDebugDump debugDump;
diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp
index 3d2d6937..ff7bbb8f 100644
--- a/lib/Plugins/Logger.cpp
+++ b/lib/Plugins/Logger.cpp
@@ -55,7 +55,7 @@ map_plugin_settings_t CLogger::GetSettings()
std::string CLogger::Report(const map_crash_report_t& pCrashReport, const std::string& pArgs)
{
- update_client("Creating a report...");
+ update_client(_("Creating a report..."));
std::stringstream binaryFiles, commonFiles, bigTextFiles, additionalFiles, UUIDFile;
std::ofstream fOut;
diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp
index 5129038f..8d009510 100644
--- a/lib/Plugins/Mailx.cpp
+++ b/lib/Plugins/Mailx.cpp
@@ -107,7 +107,7 @@ void CMailx::ExecMailx(uid_t uid, const std::string& pText)
void CMailx::SendEmail(const std::string& pSubject, const std::string& pText, const std::string& pUID)
{
- update_client("Sending an email...");
+ update_client(_("Sending an email..."));
AddMailxArg("-s");
AddMailxArg(pSubject);
@@ -121,7 +121,7 @@ void CMailx::SendEmail(const std::string& pSubject, const std::string& pText, co
std::string CMailx::Report(const map_crash_report_t& pCrashReport, const std::string& pArgs)
{
- update_client("Creating a report...");
+ update_client(_("Creating a report..."));
std::stringstream emailBody;
std::stringstream binaryFiles, commonFiles, bigTextFiles, additionalFiles, UUIDFile;
diff --git a/lib/Plugins/RunApp.cpp b/lib/Plugins/RunApp.cpp
index 29c00066..a1c31f6a 100644
--- a/lib/Plugins/RunApp.cpp
+++ b/lib/Plugins/RunApp.cpp
@@ -59,7 +59,7 @@ void CActionRunApp::ParseArgs(const std::string& psArgs, vector_args_t& pArgs)
void CActionRunApp::Run(const std::string& pActionDir,
const std::string& pArgs)
{
- update_client("Executing RunApp plugin...");
+ update_client(_("Executing RunApp plugin..."));
char line[1024];
std::string output = "";
diff --git a/lib/Plugins/SOSreport.cpp b/lib/Plugins/SOSreport.cpp
index fa10f813..4d22028f 100644
--- a/lib/Plugins/SOSreport.cpp
+++ b/lib/Plugins/SOSreport.cpp
@@ -87,7 +87,7 @@ std::string CActionSOSreport::ParseFilename(const std::string& pOutput)
void CActionSOSreport::Run(const std::string& pActionDir,
const std::string& pArgs)
{
- update_client("Executing SOSreportAction plugin...");
+ update_client(_("Executing SOSreportAction plugin..."));
const char command[] = "sosreport --batch --no-progressbar -k rpm.rpmva=off 2>&1";