[gupnp-tools] Initialize i18n support function



commit f054334e5f8db2309da75092d72ef759526afdcf
Author: Jiro Matsuzawa <jmatsuzawa gnome org>
Date:   Sat Dec 22 13:06:05 2012 +0900

    Initialize i18n support function

 src/av-cp/gui.c          |    1 +
 src/av-cp/main.c         |   10 ++++++++++
 src/network-light/gui.c  |    1 +
 src/network-light/main.c |   10 ++++++++++
 src/universal-cp/gui.c   |    1 +
 src/universal-cp/main.c  |   10 ++++++++++
 6 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/av-cp/gui.c b/src/av-cp/gui.c
index b51ae69..f991314 100644
--- a/src/av-cp/gui.c
+++ b/src/av-cp/gui.c
@@ -90,6 +90,7 @@ init_ui (gint   *argc,
 
         builder = gtk_builder_new ();
         g_assert (builder != NULL);
+        gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
 
         if (!gtk_builder_add_from_file (builder, UI_FILE, &error)) {
                 g_critical ("Unable to load the GUI file %s: %s",
diff --git a/src/av-cp/main.c b/src/av-cp/main.c
index b8b1fc0..e3b5289 100644
--- a/src/av-cp/main.c
+++ b/src/av-cp/main.c
@@ -18,11 +18,16 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <libgupnp/gupnp-control-point.h>
 #include <libgupnp-av/gupnp-av.h>
 #include <string.h>
 #include <stdlib.h>
 #include <gmodule.h>
+#include <glib/gi18n.h>
 
 #include "gui.h"
 #include "renderer-combo.h"
@@ -141,6 +146,11 @@ gint
 main (gint   argc,
       gchar *argv[])
 {
+        setlocale (LC_ALL, "");
+        bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+        textdomain (GETTEXT_PACKAGE);
+
         if (!init_ui (&argc, &argv)) {
            return -2;
         }
diff --git a/src/network-light/gui.c b/src/network-light/gui.c
index 5c6cdaf..898200d 100644
--- a/src/network-light/gui.c
+++ b/src/network-light/gui.c
@@ -199,6 +199,7 @@ init_ui (gint   *argc,
 
         builder = gtk_builder_new ();
         g_assert (builder != NULL);
+        gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);
 
         if (!gtk_builder_add_from_file (builder, UI_FILE, &error)) {
                 g_critical ("Unable to load the GUI file %s: %s",
diff --git a/src/network-light/main.c b/src/network-light/main.c
index b99cf54..401efc8 100644
--- a/src/network-light/main.c
+++ b/src/network-light/main.c
@@ -20,9 +20,14 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdio.h>
 #include <locale.h>
 #include <string.h>
+#include <glib/gi18n.h>
 
 #include "gui.h"
 #include "upnp.h"
@@ -72,6 +77,11 @@ main (int argc, char **argv)
         light_status = FALSE;
         light_load_level = 100;
 
+        setlocale (LC_ALL, "");
+        bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+        textdomain (GETTEXT_PACKAGE);
+
         if (!init_ui (&argc, &argv)) {
                 return -1;
         }
diff --git a/src/universal-cp/gui.c b/src/universal-cp/gui.c
index a03b038..e1b6235 100644
--- a/src/universal-cp/gui.c
+++ b/src/universal-cp/gui.c
@@ -108,6 +108,7 @@ init_ui (gint   *argc,
 
         builder = gtk_builder_new ();
         g_assert (builder != NULL);
+        gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
 
         if (!gtk_builder_add_from_file (builder, UI_FILE, &error)) {
                 g_critical ("Unable to load the GUI file %s: %s",
diff --git a/src/universal-cp/main.c b/src/universal-cp/main.c
index a31c8ac..f79f8f5 100644
--- a/src/universal-cp/main.c
+++ b/src/universal-cp/main.c
@@ -18,12 +18,17 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <libgupnp/gupnp.h>
 #include "gui.h"
 #include <string.h>
 #include <stdlib.h>
 
 #include <gmodule.h>
+#include <glib/gi18n.h>
 
 static GUPnPContextManager *context_manager;
 
@@ -107,6 +112,11 @@ gint
 main (gint   argc,
       gchar *argv[])
 {
+        setlocale (LC_ALL, "");
+        bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+        textdomain (GETTEXT_PACKAGE);
+
         if (!init_ui (&argc, &argv)) {
            return -2;
         }



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