core: fix internationalization of nm-openvpn-service
authorJiří Klimeš <jklimes@redhat.com>
Fri, 9 Nov 2012 09:59:31 +0000 (10:59 +0100)
committerJiří Klimeš <jklimes@redhat.com>
Fri, 9 Nov 2012 12:41:10 +0000 (13:41 +0100)
src/Makefile.am
src/nm-openvpn-service.c

index 3f21d36..5d5f6d4 100644 (file)
@@ -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
index 5eaed74..bdb220b 100644 (file)
@@ -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);