From 5aafe234442fa9cebe7202ef38ca213850eb5be8 Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky Date: Thu, 27 Aug 2009 14:34:12 +0200 Subject: CCApplet: gettext support --- src/Applet/Applet.cpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/Applet/Applet.cpp') diff --git a/src/Applet/Applet.cpp b/src/Applet/Applet.cpp index 53f0043..0c2901b 100644 --- a/src/Applet/Applet.cpp +++ b/src/Applet/Applet.cpp @@ -21,6 +21,21 @@ #include #include +#if HAVE_CONFIG_H + #include +#endif + +#if HAVE_LOCALE_H + #include +#endif + +#if ENABLE_NLS + #include + #define _(S) gettext(S) +#else + #define _(S) (S) +#endif + //@@global applet object CApplet *applet; @@ -31,12 +46,19 @@ crash_notify_cb(const char* progname) std::cerr << "Application " << progname << " has crashed!" << std::endl; #endif //applet->AddEvent(uid, std::string(progname)); - applet->SetIconTooltip("A crash in package %s has been detected!", progname); + applet->SetIconTooltip(_("A crash in package %s has been detected!"), progname); applet->ShowIcon(); } int main(int argc, char **argv) { + setlocale(LC_ALL,""); + +#if ENABLE_NLS + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); +#endif + /* need to be thread safe */ g_thread_init(NULL); gdk_threads_init(); @@ -55,7 +77,7 @@ int main(int argc, char **argv) if(session.has_name("com.redhat.abrt.applet")) { //applet is already running - std::cerr << "Applet is already running." << std::endl; + std::cerr << _("Applet is already running.") << std::endl; return -1; } else @@ -69,8 +91,8 @@ int main(int argc, char **argv) applet->ConnectCrashHandler(crash_notify_cb); if(!conn.has_name(CC_DBUS_NAME)) { - std::cout << "Daemon is not running" << std::endl; - applet->Disable("Daemon is not running"); + std::cout << _("Daemon is not running.") << std::endl; + applet->Disable(_("Daemon is not running.")); } gtk_main(); -- cgit