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



commit d7ff01f9e239848fc2780e9fc0364f305489c9ac
Author: JiÅÃ KlimeÅ <jklimes redhat com>
Date:   Fri Nov 9 10:59:31 2012 +0100

    core: fix internationalization of nm-openvpn-service

 src/Makefile.am          |    1 +
 src/nm-openvpn-service.c |   11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 3f21d36..5d5f6d4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,6 +10,7 @@ AM_CPPFLAGS = \
 	-DLIBEXECDIR=\""$(libexecdir)"\" \
 	-DLOCALSTATEDIR=\""$(localstatedir)"\" \
 	-DDATADIR=\"$(datadir)\" \
+	-DNM_OPENVPN_LOCALEDIR=\"$(datadir)/locale\"
 	-I$(top_srcdir)
 
 libexec_PROGRAMS = nm-openvpn-service nm-openvpn-service-openvpn-helper
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 5eaed74..bdb220b 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -1392,9 +1392,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_OPENVPN_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]