[network-manager-pptp] core: fix internationalization of nm-pptp-service



commit 2fd36437972f20a0b5b95264ff6fa2213b5cc0df
Author: JiÅÃ KlimeÅ <jklimes redhat com>
Date:   Fri Nov 9 11:09:01 2012 +0100

    core: fix internationalization of nm-pptp-service

 src/Makefile.am       |    1 +
 src/nm-pptp-service.c |   11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 1b39f2b..3362cdc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,6 +13,7 @@ AM_CPPFLAGS =							\
 	-DLIBEXECDIR=\""$(libexecdir)"\"			\
 	-DLOCALSTATEDIR=\""$(localstatedir)"\"		 	\
 	-DDATADIR=\"$(datadir)\"				\
+	-DNM_PPTP_LOCALEDIR=\"$(datadir)/locale\"		\
 	-DPLUGINDIR=\"$(PPPD_PLUGIN_DIR)\" 
 
 libexec_PROGRAMS = nm-pptp-service
diff --git a/src/nm-pptp-service.c b/src/nm-pptp-service.c
index ff79b31..a16677e 100644
--- a/src/nm-pptp-service.c
+++ b/src/nm-pptp-service.c
@@ -1315,9 +1315,16 @@ main (int argc, char *argv[])
 
 	g_type_init ();
 
+	/* locale will be set according to environment LC_* variables */
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, NM_PPTP_LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
 	/* Parse options */
-	opt_ctx = g_option_context_new ("");
-	g_option_context_set_translation_domain (opt_ctx, "UTF-8");
+	opt_ctx = g_option_context_new (NULL);
+	g_option_context_set_translation_domain (opt_ctx, GETTEXT_PACKAGE);
 	g_option_context_set_ignore_unknown_options (opt_ctx, FALSE);
 	g_option_context_set_help_enabled (opt_ctx, TRUE);
 	g_option_context_add_main_entries (opt_ctx, options, NULL);



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