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



commit 6a6a36b61a19bba0693f9f0a9640bebf62966ab5
Author: JiÅÃ KlimeÅ <jklimes redhat com>
Date:   Fri Nov 9 11:13:55 2012 +0100

    core: fix internationalization of nm-openconnect-service

 src/Makefile.am              |    3 ++-
 src/nm-openconnect-service.c |   11 +++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index e95b77d..3dcca5d 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_OPENCONNECT_LOCALEDIR=\"$(datadir)/locale\"
 
 libexec_PROGRAMS = \
 	nm-openconnect-service \
diff --git a/src/nm-openconnect-service.c b/src/nm-openconnect-service.c
index 56f99dd..d26190f 100644
--- a/src/nm-openconnect-service.c
+++ b/src/nm-openconnect-service.c
@@ -643,9 +643,16 @@ int main (int argc, char *argv[])
 
 	g_type_init ();
 
+	/* locale will be set according to environment LC_* variables */
+	setlocale (LC_ALL, "");
+
+	bindtextdomain (GETTEXT_PACKAGE, NM_OPENCONNECT_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]