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



commit 59a287c555a4188d85d179832e2628aee9a947c9
Author: JiÅÃ KlimeÅ <jklimes redhat com>
Date:   Fri Nov 9 11:39:55 2012 +0100

    core: fix internationalization of nm-openswan-service

 src/Makefile.am           |    3 ++-
 src/nm-openswan-service.c |   11 +++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index a860e14..12ce851 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_OPENSWAN_LOCALEDIR=\"$(datadir)/locale\"
 
 libexec_PROGRAMS = nm-openswan-service nm-openswan-service-helper
 
diff --git a/src/nm-openswan-service.c b/src/nm-openswan-service.c
index 348a35b..30e6e46 100644
--- a/src/nm-openswan-service.c
+++ b/src/nm-openswan-service.c
@@ -880,9 +880,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_OPENSWAN_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]