[gegl] gegl: call gegl_init_i18n() from gegl_get_option_group()



commit 70508224d709f0467b486a6e92d9fcbec2cfb1f4
Author: Michael Natterer <mitch gimp org>
Date:   Sat May 24 17:30:51 2014 +0200

    gegl: call gegl_init_i18n() from gegl_get_option_group()
    
    So it is always called no matter if gegl_init() is used or not.
    Also, don't call setlocale(), that's not the job of a library.

 gegl/gegl-init.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/gegl/gegl-init.c b/gegl/gegl-init.c
index 902be85..91baf04 100644
--- a/gegl/gegl-init.c
+++ b/gegl/gegl-init.c
@@ -211,9 +211,15 @@ gegl_config_use_opencl_notify (GObject    *gobject,
 static void
 gegl_init_i18n (void)
 {
-  setlocale (LC_ALL, "");
-  bindtextdomain (GETTEXT_PACKAGE, GEGL_LOCALEDIR);
-  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  static gboolean i18n_initialized = FALSE;
+
+  if (! i18n_initialized)
+    {
+      bindtextdomain (GETTEXT_PACKAGE, GEGL_LOCALEDIR);
+      bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+      i18n_initialized = TRUE;
+    }
 }
 
 void
@@ -229,8 +235,6 @@ gegl_init (gint    *argc,
 
   initialized = TRUE;
 
-  gegl_init_i18n ();
-
   context = g_option_context_new (NULL);
   g_option_context_set_ignore_unknown_options (context, TRUE);
   g_option_context_set_help_enabled (context, FALSE);
@@ -298,6 +302,8 @@ gegl_get_option_group (void)
 {
   GOptionGroup *group;
 
+  gegl_init_i18n ();
+
   group = g_option_group_new ("gegl", "GEGL Options", "Show GEGL Options",
                               NULL, NULL);
   g_option_group_add_entries (group, cmd_entries);


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