Author: ek.kato
Date: Thu Apr 30 00:26:39 2009
New Revision: 5954

Modified:
   trunk/notify/uim-growl.m
   trunk/notify/uim-knotify3.cc
   trunk/notify/uim-libnotify.c

Log:
* notify/uim-knotify3.cc
* notify/uim-libnotify.c
* notify/uim-growl.m
  - Use gettext.


Modified: trunk/notify/uim-growl.m
==============================================================================
--- trunk/notify/uim-growl.m    (original)
+++ trunk/notify/uim-growl.m    Thu Apr 30 00:26:39 2009
@@ -42,27 +42,26 @@

 #include "uim.h"  /* for uim_bool */
 #include "uim-notify.h"
+#include "gettext.h"

+#define UGETTEXT(str)  (dgettext(GETTEXT_PACKAGE, (str)))

 static uim_bool
 uim_growl_notify(int prio, BOOL is_sticky, const char *body)
 {
   char body_short[256];
-
-  BOOL ret;
-  char *msg;
-  NSString *string;
   const char *str[3] = {"uim notify info", "dummy", "uim notify fatal"};
+  const char *title[3] = {"Info", "dummy", "Fatal"};

   if (prio > 2 || prio < 0)
     return UIM_FALSE;

-  strlcpy(body_short, body, sizeof(body_short));
+  strlcpy(body_short, UGETTEXT(body), sizeof(body_short));

-  fprintf(stderr, "libuim: %s\n", body);
+  fprintf(stderr, "libuim: %s\n", UGETTEXT(body));

   [GrowlApplicationBridge
-         notifyWithTitle:@"uim Notification"
+         notifyWithTitle:[NSString stringWithCString:title[prio]]
              description:[NSString stringWithUTF8String:body_short]
         notificationName:[NSString stringWithCString:str[prio]]
                 iconData:nil

Modified: trunk/notify/uim-knotify3.cc
==============================================================================
--- trunk/notify/uim-knotify3.cc        (original)
+++ trunk/notify/uim-knotify3.cc        Thu Apr 30 00:26:39 2009
@@ -43,7 +43,9 @@

 #include "uim.h"  // for uim_bool
 #include "uim-notify.h"
+#include "gettext.h"

+#define UGETTEXT(str)  (dgettext(GETTEXT_PACKAGE, (str)))

 static uim_notify_desc uim_notify_knotify3_desc = {
   "knotify3",
@@ -68,7 +70,6 @@
   return;
 }

-/* FIXME: gettext msg */
 static uim_bool
 send_knotify(const char *eventstr, const char *msg, int level)
 {
@@ -79,8 +80,8 @@
   QString event(eventstr), fromApp("uim"), text, sound(""), file("");
   int present = KNotifyClient::Messagebox | level;

-  snprintf(body, sizeof(body), "libuim: %s", msg);
-  fprintf(stderr, "%s\n", msg);
+  snprintf(body, sizeof(body), "libuim: %s", UGETTEXT(msg));
+  fprintf(stderr, "%s\n", UGETTEXT(msg));

   strlcpy(body_short, body, sizeof(body_short));
   text = body_short;

Modified: trunk/notify/uim-libnotify.c
==============================================================================
--- trunk/notify/uim-libnotify.c        (original)
+++ trunk/notify/uim-libnotify.c        Thu Apr 30 00:26:39 2009
@@ -42,10 +42,11 @@

 #include "uim.h"  /* for uim_bool */
 #include "uim-notify.h"
+#include "gettext.h"

 #define UIM_ICON UIM_PIXMAPSDIR "/uim-icon.png"
+#define UGETTEXT(str)  (dgettext(GETTEXT_PACKAGE, (str)))

-/* FIXME: gettext body */
 static uim_bool
 uim_libnotify_notify(int urgency, int timeout, const char *body)
 {
@@ -56,9 +57,9 @@
   gchar *gmsg;
   gsize read, written;

-  strlcpy(body_short, body, sizeof(body_short));
+  strlcpy(body_short, UGETTEXT(body), sizeof(body_short));

-  fprintf(stderr, "libuim: %s\n", body);
+  fprintf(stderr, "libuim: %s\n", UGETTEXT(body));

   gmsg = g_locale_to_utf8(body_short, -1, &read, &written, NULL);

Reply via email to