Initialize gettext in secret-tool
authorStef Walter <stefw@gnome.org>
Tue, 17 Jul 2012 08:14:27 +0000 (10:14 +0200)
committerStef Walter <stefw@gnome.org>
Wed, 18 Jul 2012 05:40:01 +0000 (07:40 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=680072

tool/Makefile.am
tool/secret-tool.c

index d3af455..f41e0f6 100644 (file)
@@ -4,6 +4,7 @@ INCLUDES = \
        -I$(top_srcdir) \
        -I$(top_srcdir)/libsecret \
        -DSECRET_COMPILATION \
+       -DLOCALEDIR=\""$(datadir)/locale"\" \
        $(NULL)
 
 bin_PROGRAMS = secret-tool
index fd0792b..def22f5 100644 (file)
@@ -21,6 +21,7 @@
 #include <glib/gi18n.h>
 
 #include <errno.h>
+#include <locale.h>
 #include <limits.h>
 #include <stdlib.h>
 
@@ -336,6 +337,14 @@ main (int argc,
 {
        SecretToolAction action;
 
+       setlocale (LC_ALL, "");
+
+#ifdef ENABLE_NLS
+       bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+       textdomain (GETTEXT_PACKAGE);
+#endif
+
        g_type_init ();
 
        if (argc < 2)