diff options
author | Nikola Pajkovsky <npajkovs@redhat.com> | 2009-08-27 14:34:12 +0200 |
---|---|---|
committer | Nikola Pajkovsky <npajkovs@redhat.com> | 2009-08-27 14:34:12 +0200 |
commit | 5aafe234442fa9cebe7202ef38ca213850eb5be8 (patch) | |
tree | 2b5482f9692344775eb9804c6e8a8d86ceaf318d | |
parent | 8c0d6a2a3eb9ed0f31e9dbd4ff1c18929932b982 (diff) | |
download | abrt-5aafe234442fa9cebe7202ef38ca213850eb5be8.tar.gz abrt-5aafe234442fa9cebe7202ef38ca213850eb5be8.tar.xz abrt-5aafe234442fa9cebe7202ef38ca213850eb5be8.zip |
CCApplet: gettext support
-rw-r--r-- | po/POTFILES.in | 3 | ||||
-rw-r--r-- | po/cs.po | 53 | ||||
-rw-r--r-- | src/Applet/Applet.cpp | 30 | ||||
-rw-r--r-- | src/Applet/CCApplet.cpp | 38 | ||||
-rw-r--r-- | src/Applet/Makefile.am | 2 |
5 files changed, 110 insertions, 16 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in index 833b1d42..7d6ebcde 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -19,3 +19,6 @@ src/Gui/PluginSettingsUI.py src/Gui/report.glade src/Gui/SettingsDialog.py # /src/settings.GtkBuilder +src/Applet/Applet.cpp +src/Applet/CCApplet.cpp + @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ABRT 0.7.1.1\n" "Report-Msgid-Bugs-To: jmoskovc@redhat.com\n" -"POT-Creation-Date: 2009-08-26 10:19+0200\n" +"POT-Creation-Date: 2009-08-27 14:29+0200\n" "PO-Revision-Date: 2009-08-25 22:04+ZONE\n" "Last-Translator: JIRI MOSKOVCAK <jmoskovc@redhat.com>\n" "Language-Team: CZECH <ll@li.org>\n" @@ -24,16 +24,16 @@ msgstr "" msgid "Got unexpected data from daemon (is the database properly updated?)." msgstr "" -#: src/Gui/CCDBusBackend.py:135 +#: src/Gui/CCDBusBackend.py:140 msgid "Can't connect to dbus" msgstr "" -#: src/Gui/CCDBusBackend.py:139 src/Gui/CCDBusBackend.py:157 +#: src/Gui/CCDBusBackend.py:144 src/Gui/CCDBusBackend.py:163 msgid "Please check if abrt daemon is running." msgstr "" "Nepodařilo se připojit k démonovi, zkontrolujte prosím, zda služba abrt běží." -#: src/Gui/CCDBusBackend.py:169 +#: src/Gui/CCDBusBackend.py:181 msgid "" "Daemon did't return valid report info\n" "Debuginfo is missing?" @@ -230,3 +230,48 @@ msgstr "" #: src/Gui/SettingsDialog.py:122 msgid "unknown response from settings dialog" msgstr "" + +#: src/Applet/Applet.cpp:49 +#, c-format +msgid "A crash in package %s has been detected!" +msgstr "Zjištěn pád v balíčku %s" + +#: src/Applet/Applet.cpp:80 +msgid "Applet is already running." +msgstr "Applet už běží." + +#: src/Applet/Applet.cpp:94 src/Applet/Applet.cpp:95 +msgid "Daemon is not running." +msgstr "Služba není spuštěná." + +#: src/Applet/CCApplet.cpp:90 src/Applet/CCApplet.cpp:256 +#, c-format +msgid "Pending events: %i" +msgstr "" + +#: src/Applet/CCApplet.cpp:109 +#, c-format +msgid "Can't create menu from the description, popup won't be available!\n" +msgstr "" + +#: src/Applet/CCApplet.cpp:132 +msgid "" +"This is default handler, you should register your own with " +"ConnectCrashHandler" +msgstr "" + +#: src/Applet/CCApplet.cpp:142 +msgid "ABRT service is not running" +msgstr "ěščřěščřěščř" + +#: src/Applet/CCApplet.cpp:146 +msgid "ABRT service has been started" +msgstr "ěščřěščřěščř" + +#: src/Applet/CCApplet.cpp:167 +msgid "Warning" +msgstr "" + +#: src/Applet/CCApplet.cpp:173 +msgid "Out of memory" +msgstr "" diff --git a/src/Applet/Applet.cpp b/src/Applet/Applet.cpp index 53f00436..0c2901ba 100644 --- a/src/Applet/Applet.cpp +++ b/src/Applet/Applet.cpp @@ -21,6 +21,21 @@ #include <iostream> #include <dbus/dbus-shared.h> +#if HAVE_CONFIG_H + #include <config.h> +#endif + +#if HAVE_LOCALE_H + #include <locale.h> +#endif + +#if ENABLE_NLS + #include <libintl.h> + #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(); diff --git a/src/Applet/CCApplet.cpp b/src/Applet/CCApplet.cpp index 187cce35..c93bd8ac 100644 --- a/src/Applet/CCApplet.cpp +++ b/src/Applet/CCApplet.cpp @@ -24,6 +24,21 @@ #include <sstream> #include <cstdio> + + +#if HAVE_CONFIG_H + #include <config.h> +#endif + +#if ENABLE_NLS + #include <libintl.h> + #define _(S) gettext(S) +#else + #define _(S) (S) +#endif + + + static const char *DBUS_SERVICE_NAME = "org.freedesktop.DBus"; static const char *DBUS_SERVICE_PATH = "/org/freedesktop/DBus"; const gchar *CApplet::menu_xml = @@ -54,6 +69,13 @@ const gchar *CApplet::menu_xml = CApplet::CApplet(DBus::Connection &connection, const char *path, const char *name) : DBus::ObjectProxy(connection, path, name) { + setlocale(LC_ALL,""); + +#if ENABLE_NLS + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); +#endif + m_pDaemonWatcher = new DaemonWatcher(connection, DBUS_SERVICE_PATH, DBUS_SERVICE_NAME); m_pDaemonWatcher->ConnectStateChangeHandler(DaemonStateChange_cb, this); m_pStatusIcon = gtk_status_icon_new_from_stock(GTK_STOCK_DIALOG_WARNING); @@ -65,7 +87,7 @@ CApplet::CApplet(DBus::Connection &connection, const char *path, const char *nam gtk_status_icon_set_visible(m_pStatusIcon, FALSE); g_signal_connect(G_OBJECT(m_pStatusIcon), "activate", GTK_SIGNAL_FUNC(CApplet::OnAppletActivate_CB), this); g_signal_connect(G_OBJECT(m_pStatusIcon), "popup_menu", GTK_SIGNAL_FUNC(CApplet::OnMenuPopup_cb), this); - SetIconTooltip("Pending events: %i", m_mapEvents.size()); + SetIconTooltip(_("Pending events: %i"), m_mapEvents.size()); m_pBuilder = gtk_builder_new(); if(gtk_builder_add_from_string(m_pBuilder, menu_xml, strlen(menu_xml), NULL)) { @@ -84,7 +106,7 @@ CApplet::CApplet(DBus::Connection &connection, const char *path, const char *nam } else { - fprintf(stderr,"Can't create menu from the description, popup won't be available!\n"); + fprintf(stderr,_("Can't create menu from the description, popup won't be available!\n")); } } @@ -107,7 +129,7 @@ void CApplet::Crash(const std::string& progname, const std::string& uid ) } else { - std::cout << "This is default handler, you should register your own with ConnectCrashHandler" << std::endl; + std::cout << _("This is default handler, you should register your own with ConnectCrashHandler") << std::endl; std::cout.flush(); } } @@ -117,11 +139,11 @@ void CApplet::DaemonStateChange_cb(bool running, void* data) CApplet *applet = (CApplet *)data; if (!running) { - applet->Disable("ABRT service is not running"); + applet->Disable(_("ABRT service is not running")); } else { - applet->Enable("ABRT service has been started"); + applet->Enable(_("ABRT service has been started")); } } @@ -142,13 +164,13 @@ void CApplet::SetIconTooltip(const char *format, ...) va_end(args); if (n >= 0 && buf) { - notify_notification_update(m_pNotification, "Warning", buf, NULL); + notify_notification_update(m_pNotification, _("Warning"), buf, NULL); gtk_status_icon_set_tooltip_text(m_pStatusIcon, buf); free(buf); } else { - gtk_status_icon_set_tooltip_text(m_pStatusIcon, "Out of memory"); + gtk_status_icon_set_tooltip_text(m_pStatusIcon, _("Out of memory")); } } @@ -231,7 +253,7 @@ void CApplet::Enable(const char *reason) int CApplet::AddEvent(int pUUID, const std::string& pProgname) { m_mapEvents[pUUID] = "pProgname"; - SetIconTooltip("Pending events: %i", m_mapEvents.size()); + SetIconTooltip(_("Pending events: %i"), m_mapEvents.size()); return 0; } diff --git a/src/Applet/Makefile.am b/src/Applet/Makefile.am index 952703e4..886102ff 100644 --- a/src/Applet/Makefile.am +++ b/src/Applet/Makefile.am @@ -20,5 +20,7 @@ abrt_applet_LDADD = \ EXTRA_DIST = abrt-applet.desktop popup.GtkBuilder +DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ + autostartdir = $(sysconfdir)/xdg/autostart autostart_DATA = abrt-applet.desktop |