[gobject-introspection] g-ir-{compiler, generate, inspect}: Call setlocale in main function



commit 74e4542739df792d4a1f42eecd756506140703b0
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Mon Jan 11 13:35:34 2016 +0800

    g-ir-{compiler,generate,inspect}: Call setlocale in main function
    
    It is required to correctly show translated messages on some locales.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760419

 tools/compiler.c     |    3 +++
 tools/g-ir-inspect.c |    3 +++
 tools/generate.c     |    4 ++++
 3 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/tools/compiler.c b/tools/compiler.c
index 9485761..06d87d9 100644
--- a/tools/compiler.c
+++ b/tools/compiler.c
@@ -20,6 +20,7 @@
  */
 
 #include <errno.h>
+#include <locale.h>
 #include <string.h>
 
 #include <glib.h>
@@ -148,6 +149,8 @@ main (int argc, char ** argv)
   gint i;
   g_typelib_check_sanity ();
 
+  setlocale (LC_ALL, "");
+
   context = g_option_context_new ("");
   g_option_context_add_main_entries (context, options, NULL);
   g_option_context_parse (context, &argc, &argv, &error);
diff --git a/tools/g-ir-inspect.c b/tools/g-ir-inspect.c
index 6152f9a..2dfe61c 100644
--- a/tools/g-ir-inspect.c
+++ b/tools/g-ir-inspect.c
@@ -22,6 +22,7 @@
 #include <glib.h>
 #include <girepository.h>
 #include <stdlib.h>
+#include <locale.h>
 
 static void
 print_shlibs (const gchar *namespace)
@@ -77,6 +78,8 @@ main (gint   argc,
     { NULL },
   };
 
+  setlocale (LC_ALL, "");
+
   GOptionContext *context = g_option_context_new ("- Inspect GI typelib");
   g_option_context_add_main_entries (context, options, NULL);
   if (!g_option_context_parse (context, &argc, &argv, &error))
diff --git a/tools/generate.c b/tools/generate.c
index 3e31097..926ffca 100644
--- a/tools/generate.c
+++ b/tools/generate.c
@@ -20,6 +20,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include <locale.h>
+
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <gmodule.h>
@@ -54,6 +56,8 @@ main (int argc, char *argv[])
 
   g_typelib_check_sanity ();
 
+  setlocale (LC_ALL, "");
+
   context = g_option_context_new ("");
   g_option_context_add_main_entries (context, options, NULL);
   g_option_context_parse (context, &argc, &argv, &error);


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