Revision: 7188
Author:   ek.kato
Date:     Wed Jul  6 18:03:44 2011
Log:      * po/POTFILES.in : Add scm/fileio.scm.
* scm/fileio.scm (file-ready?) : Fix gettext usage.
* scm/dict-socket.scm (dict-server-get-message) : Ditto.
* scm/process.scm (process-io, process-with-daemon): Ditto.
* uim/dynlib.c (dynlib_bind_internal) : Ditto.
* uim/skk.c (open_skkserv) : Ditto.             
* uim/uim-notify.c (uim_notify_stderr_info, uim_notify_stderr_fatal) :
  dgettext msgs for uim_notify.
* uim/uim.c (notify_info, notify_fatal) : Ditto.        
* uim/uim-notify.h : Fix comment.

http://code.google.com/p/uim/source/detail?r=7188

Modified:
 /trunk/po/POTFILES.in
 /trunk/scm/dict-socket.scm
 /trunk/scm/fileio.scm
 /trunk/scm/process.scm
 /trunk/uim/dynlib.c
 /trunk/uim/skk.c
 /trunk/uim/uim-notify.c
 /trunk/uim/uim-notify.h
 /trunk/uim/uim.c

=======================================
--- /trunk/po/POTFILES.in       Wed May 25 18:47:32 2011
+++ /trunk/po/POTFILES.in       Wed Jul  6 18:03:44 2011
@@ -45,6 +45,7 @@
 scm/direct.scm
 scm/elatin-custom.scm
 scm/elatin.scm
+scm/fileio.scm
 scm/generic-custom.scm
 scm/generic-key-custom.scm
 scm/generic.scm
=======================================
--- /trunk/scm/dict-socket.scm  Thu Jan  6 18:09:56 2011
+++ /trunk/scm/dict-socket.scm  Wed Jul  6 18:03:44 2011
@@ -74,7 +74,7 @@
     (receive (responce message)
         (dict-server-parse-responce line)
       (cond ((dict-server-error-responce? responce)
- (uim-notify-fatal (format "dict (~a): ~a" (N_ "Error Response") message))) + (uim-notify-fatal (format "dict (~a): ~a" (_ "Error Response") message)))
             ((string=? "151" responce)
              (dict-server-get-1yz port))
             ((string=? "150" responce)
@@ -83,7 +83,7 @@
                      (dict-server-parse-responce responce-line)
                    (if (string=? "151" (substring responce-line 0 3))
                        (dict-server-get-1yz port)
- (uim-notify-fatal (format "dict (~a): ~a" (N_ "Error Response") message)))))) + (uim-notify-fatal (format "dict (~a): ~a" (_ "Error Response") message))))))
             ((string=? "2" (substring responce 0 1))
              '())
             ((string=? "4" (substring responce 0 1))
@@ -91,7 +91,7 @@
             ((string=? "5" (substring responce 0 1))
              '())
             (else
- (uim-notify-fatal (format "~a ~a" (N_ "dict: Protocol error") message))))))) + (uim-notify-fatal (format "~a ~a" (_ "dict: Protocol error") message)))))))


 (define (dict-server-parse-banner port)
=======================================
--- /trunk/scm/fileio.scm       Thu Jan  6 18:09:56 2011
+++ /trunk/scm/fileio.scm       Wed Jul  6 18:03:44 2011
@@ -235,7 +235,7 @@
                    fd-list))
          (ret (file-poll fds timeout)))
     (cond ((not ret)
- (uim-notify-fatal (format "~a: '~a'" (N_ "poll error") (posix-error-string))) + (uim-notify-fatal (format "~a: '~a'" (_ "poll error") (posix-error-string)))
            #f)
           ((null? ret)
            ;;(uim-notify-info (N_ "timeout"))
=======================================
--- /trunk/scm/process.scm      Thu Jan  6 18:09:56 2011
+++ /trunk/scm/process.scm      Wed Jul  6 18:03:44 2011
@@ -82,7 +82,7 @@
                (file-close pout-out)

                (if (= (process-execute file argv) -1)
-                 (uim-notify-fatal (format (N_ "cannot execute ~a") file)))
+                 (uim-notify-fatal (format (_ "cannot execute ~a") file)))
                (set! ret (bitwise-ior ret process-exec-failed))
                (file-write-string 1 (number->string ret))
                (_exit 1)
@@ -111,7 +111,7 @@
             ((= 0 pid) ;; child
              (daemon 0 1)
              (if (= (process-execute file argv) -1)
-               (uim-notify-fatal (format (N_ "cannot execute ~a") file)))
+               (uim-notify-fatal (format (_ "cannot execute ~a") file)))
              (_exit 1))
             (else
              pid)))))
=======================================
--- /trunk/uim/dynlib.c Tue Jul  5 08:15:13 2011
+++ /trunk/uim/dynlib.c Wed Jul  6 18:03:44 2011
@@ -146,7 +146,7 @@
   library = dlopen(REFER_C_STR(name), RTLD_NOW);

   if (library == NULL) {
-    uim_notify_fatal(N_("dynlib: %s: Load failed."), dlerror());
+    uim_notify_fatal(_("dynlib: %s: Load failed."), dlerror());
     return uim_scm_f();
   }

@@ -155,7 +155,7 @@
   dynlib_instance_quit
     = (void (*)(void))dlfunc(library, "uim_dynlib_instance_quit");
   if (!dynlib_instance_init) {
- uim_notify_fatal(N_("dynlib: %s: Initialization failed."), REFER_C_STR(name)); + uim_notify_fatal(_("dynlib: %s: Initialization failed."), REFER_C_STR(name));
     return uim_scm_f();
   }

=======================================
--- /trunk/uim/skk.c    Fri Jan 21 18:16:42 2011
+++ /trunk/uim/skk.c    Wed Jul  6 18:03:44 2011
@@ -3693,10 +3693,7 @@
   freeaddrinfo(aitop);

   if (sock == -1) {
-    /* FIXME: gettext here to expand %s in accordance with the
-     * locale for the selected notification agent. See also the TODO
-     * comment of uim-notify.h  -- YamaKen 2008-02-11 */
- uim_notify_fatal(N_("uim-skk: connect to %s port %s failed"), hostname, port); + uim_notify_fatal(_("uim-skk: connect to %s port %s failed"), hostname, port);
     return 0;
   }

=======================================
--- /trunk/uim/uim-notify.c     Thu Jan  6 18:09:56 2011
+++ /trunk/uim/uim-notify.c     Wed Jul  6 18:03:44 2011
@@ -50,7 +50,7 @@
 #include "uim-scm-abbrev.h"
 #include "uim-internal.h"
 #include "uim-notify.h"
-
+#include "gettext.h"

 #define NOTIFY_PLUGIN_PATH PKGLIBDIR "/notify"
 #define NOTIFY_PLUGIN_PREFIX "libuimnotify-"
@@ -367,7 +367,7 @@
 uim_notify_stderr_info(const char *msg)
 {
   fputs("libuim: [info] ", stderr);
-  fputs(msg, stderr);
+  fputs(dgettext(GETTEXT_PACKAGE, msg), stderr);
   fputs("\n", stderr);

   return UIM_TRUE;
@@ -380,7 +380,7 @@
    * exhaustion, printf()s with indirect directives are intentionally
    * avoided here.  -- YamaKen 2008-02-11 */
   fputs("libuim: [fatal] ", stderr);
-  fputs(msg, stderr);
+  fputs(dgettext(GETTEXT_PACKAGE, msg), stderr);
   fputs("\n", stderr);

   return UIM_TRUE;
=======================================
--- /trunk/uim/uim-notify.h     Thu Jan  6 18:09:56 2011
+++ /trunk/uim/uim-notify.h     Wed Jul  6 18:03:44 2011
@@ -36,12 +36,11 @@

 */

-/* TODO: Add a new API to get the locale for the currently activated
- * notification agent to gettext message strings contain format string
- * such as "uim-canna: Failed to mount dictionary %s." in client
- * side. The locale of the process is not appropriate since it may be
- * ja_JP.eucJP and so on and ordinary notification agents expect
- * UTF-8.  -- YamaKen 2008-02-11 */
+/*
+ * It is notification plugin's responsibility to convert messages into
+ * encoding suitable for the notification agents. Messages are assumed to
+ * be tranlated by gettext into the encoding of working locale of the process.
+ */

 #ifndef UIM_NOTIFY_H
 #define UIM_NOTIFY_H
=======================================
--- /trunk/uim/uim.c    Tue Jul  5 08:35:30 2011
+++ /trunk/uim/uim.c    Wed Jul  6 18:03:44 2011
@@ -767,7 +767,7 @@
 {
   const char *msg = REFER_C_STR(msg_);

-  return MAKE_BOOL(uim_notify_info("%s", msg));
+  return MAKE_BOOL(uim_notify_info("%s", dgettext(GETTEXT_PACKAGE, msg)));
 }

 static uim_lisp
@@ -775,7 +775,7 @@
 {
   const char *msg = REFER_C_STR(msg_);

-  return MAKE_BOOL(uim_notify_fatal("%s", msg));
+  return MAKE_BOOL(uim_notify_fatal("%s", dgettext(GETTEXT_PACKAGE, msg)));
 }

 void

Reply via email to