diff notify.c @ 8:58a3312a1c59

add internationalization support add German translation --HG-- rename : pk-update-icon.desktop => pk-update-icon.desktop.in
author Guido Berhoerster <guido@berhoerster.name>
date Tue, 11 Oct 2011 17:07:49 +0200
parents f8ad23e60000
children 2da5037fdfad
line wrap: on
line diff
--- a/notify.c	Tue Oct 11 17:07:49 2011 +0200
+++ b/notify.c	Tue Oct 11 17:07:49 2011 +0200
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Pavol Rusnak <stick@gk2.sk>
+ * Copyright (C) 2011 Guido Berhoerster <gber@opensuse.org>
  *
  * Licensed under the GNU General Public License Version 2
  *
@@ -18,20 +19,17 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <libnotify/notify.h>
 #include "notify.h"
 
-#define NOTIFY_NAME "Software Update"
-
 void init_notify()
 {
-	notify_init(NOTIFY_NAME);
+	notify_init(PACKAGE);
 }
 
 void send_notify(struct UpdatesInfo *info)
 {
 	NotifyNotification *ntfy;
-	ntfy = notify_notification_new(NOTIFY_NAME, notify_text(info), info->critical > 0 ? "software-update-urgent" : "software-update-available");
+	ntfy = notify_notification_new(_("Software Update(s)"), notify_text(info), info->critical > 0 ? "software-update-urgent" : "software-update-available");
 	notify_notification_set_timeout(ntfy, 3000);
 	notify_notification_set_urgency(ntfy, info->critical > 0 ? NOTIFY_URGENCY_CRITICAL : NOTIFY_URGENCY_NORMAL);
 	notify_notification_show(ntfy, NULL);
@@ -41,9 +39,9 @@
 {
 	static char buf[128];
 	if (info->critical > 0) {
-		snprintf(buf, sizeof(buf), "There are %d software updates available, %d of them critical.", info->normal + info->critical, info->critical);
+		snprintf(buf, sizeof(buf), _("There are %d software updates available, %d of them critical."), info->normal + info->critical, info->critical);
 	} else {
-		snprintf(buf, sizeof(buf), "There are %d software updates available.", info->normal);
+		snprintf(buf, sizeof(buf), _("There are %d software updates available."), info->normal);
 	}
 	return buf;
 }