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



commit 100aaabb78a42e633ba6d44822fad5513f50937d
Author: JiÅÃ KlimeÅ <jklimes redhat com>
Date:   Fri Nov 9 10:41:16 2012 +0100

    core: fix internationalization of nm-vpnc-service

 src/Makefile.am       |    3 ++-
 src/nm-vpnc-service.c |   11 +++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c0ca5e..0dd2b9b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,7 +12,8 @@ AM_CPPFLAGS = \
 	-DLIBDIR=\""$(libdir)"\" \
 	-DLIBEXECDIR=\""$(libexecdir)"\" \
 	-DLOCALSTATEDIR=\""$(localstatedir)"\" \
-	-DDATADIR=\"$(datadir)\"
+	-DDATADIR=\"$(datadir)\" \
+	-DNM_VPNC_LOCALEDIR=\"$(datadir)/locale\"
 
 libexec_PROGRAMS = nm-vpnc-service nm-vpnc-service-vpnc-helper
 
diff --git a/src/nm-vpnc-service.c b/src/nm-vpnc-service.c
index 296d8f4..9595146 100644
--- a/src/nm-vpnc-service.c
+++ b/src/nm-vpnc-service.c
@@ -726,9 +726,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_VPNC_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]