[gegl] enable i18n for the gegl binary



commit a42787d99640f3e2c18f9c24139461ad3f071a12
Author: Michael Murà <batolettre gmail com>
Date:   Wed Jul 18 14:43:51 2012 +0900

    enable i18n for the gegl binary

 bin/gegl-options.c |   25 +++++++++++++------------
 bin/gegl.c         |    9 +++++----
 po/POTFILES.in     |    2 ++
 3 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/bin/gegl-options.c b/bin/gegl-options.c
index 88c3af3..882eb36 100644
--- a/bin/gegl-options.c
+++ b/bin/gegl-options.c
@@ -18,6 +18,7 @@
 
 #include "config.h"
 
+#include <glib/gi18n-lib.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -41,7 +42,7 @@ static G_GNUC_NORETURN void
 usage (char *application_name)
 {
     fprintf (stderr,
-"usage: %s [options] <file | -- [op [op] ..]>\n"
+_("usage: %s [options] <file | -- [op [op] ..]>\n"
 "\n"
 "  Options:\n"
 "     -h, --help      this help information\n"
@@ -65,7 +66,7 @@ usage (char *application_name)
 "All parameters following -- are considered ops to be chained together\n"
 "into a small composition instead of using an xml file, this allows for\n"
 "easy testing of filters. Be aware that the default value will be used\n"
-"for all properties.\n"
+"for all properties.\n")
 , application_name);
     exit (0);
 }
@@ -73,7 +74,7 @@ usage (char *application_name)
 #define match(string) (!strcmp (*curr, (string)))
 #define assert_argument() do {\
     if (!curr[1] || curr[1][0]=='-') {\
-        fprintf (stderr, "ERROR: '%s' option expected argument\n", *curr);\
+        fprintf (stderr, _("ERROR: '%s' option expected argument\n"), *curr);\
         exit(-1);\
     }\
 }while(0)
@@ -112,27 +113,27 @@ print_opts (GeglOptions *o)
   switch (o->mode)
     {
       case GEGL_RUN_MODE_DISPLAY:
-        mode_str = "Display on screen"; break;
+        mode_str = _("Display on screen"); break;
       case GEGL_RUN_MODE_XML:
-        mode_str = "Print XML"; break;
+        mode_str = _("Print XML"); break;
       case GEGL_RUN_MODE_OUTPUT:
-        mode_str = "Output in a file"; break;
+        mode_str = _("Output in a file"); break;
       case GEGL_RUN_MODE_HELP:
-        mode_str = "Display help information"; break;
+        mode_str = _("Display help information"); break;
       default:
-        g_warning ("Unknown GeglOption mode: %d", o->mode);
-        mode_str = "unknown mode";
+        g_warning (_("Unknown GeglOption mode: %d"), o->mode);
+        mode_str = _("unknown mode");
         break;
     }
 
     fprintf (stderr,
-"Parsed commandline:\n"
+_("Parsed commandline:\n"
 "\tmode:   %s\n"
 "\tfile:   %s\n"
 "\txml:    %s\n"
 "\toutput: %s\n"
 "\trest:   %s\n"
-"\t\n",
+"\t\n"),
     mode_str,
     o->file==NULL?"(null)":o->file,
     o->xml==NULL?"(null)":o->xml,
@@ -253,7 +254,7 @@ parse_args (int    argc,
         }
 
         else if (*curr[0]=='-') {
-            fprintf (stderr, "\n\nunknown parameter '%s' giving you help instead\n\n\n", *curr);
+            fprintf (stderr, _("\n\nunknown parameter '%s' giving you help instead\n\n\n"), *curr);
             usage (argv[0]);
         }
 
diff --git a/bin/gegl.c b/bin/gegl.c
index 6db3884..20f23db 100644
--- a/bin/gegl.c
+++ b/bin/gegl.c
@@ -20,6 +20,7 @@
 
 #include <glib.h>
 #include <glib/gprintf.h>
+#include <glib/gi18n-lib.h>
 #include <gegl.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -143,7 +144,7 @@ main (gint    argc,
           g_file_get_contents (o->file, &script, NULL, &err);
           if (err != NULL)
             {
-              g_warning ("Unable to read file: %s", err->message);
+              g_warning (_("Unable to read file: %s"), err->message);
             }
         }
       else
@@ -187,7 +188,7 @@ main (gint    argc,
 
   if (!gegl)
     {
-      g_print ("Invalid graph, abort.\n");
+      g_print (_("Invalid graph, abort.\n"));
       return 1;
     }
 
@@ -247,13 +248,13 @@ main (gint    argc,
           gegl_node_process (output);
           g_object_unref (output);
         }
-        break;  
+        break;
 
       case GEGL_RUN_MODE_HELP:
         break;
 
       default:
-        g_warning ("Unknown GeglOption mode: %d", o->mode);
+        g_warning (_("Unknown GeglOption mode: %d"), o->mode);
         break;
     }
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cc6404c..32aa5d8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,6 @@
 [encoding: UTF-8]
+bin/gegl.c
+bin/gegl-options.c
 gegl/gegl-init.c
 gegl/module/geglmodule.c
 operations/common/bilateral-filter.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]