summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEric Koegel <eric.koegel@gmail.com>2014-10-12 09:39:07 +0300
committerEric Koegel <eric.koegel@gmail.com>2014-10-12 09:42:31 +0300
commitd6134407405b56d33c0b8d3f1769214c71dd677e (patch)
tree90ca6721edd7edd98e5c5eb9ae3cba3c883b7493 /tools
parent479b216000352df7dcc47713b48e2a8bcaf8e45a (diff)
downloadConsoleKit2-d6134407405b56d33c0b8d3f1769214c71dd677e.tar.gz
Add i18n support
Sets up ConsoleKit2 for translations via GNU gettext. There might still be a couple strings that need to be marked for translation, but this sets up the project to use gettext. Fixes bug: https://bugs.freedesktop.org/show_bug.cgi?id=23482
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am1
-rw-r--r--tools/ck-collect-session-info.c10
-rw-r--r--tools/ck-get-x11-display-device.c10
-rw-r--r--tools/ck-get-x11-server-pid.c10
-rw-r--r--tools/ck-history.c9
-rw-r--r--tools/ck-launch-session.c10
-rw-r--r--tools/ck-log-system-restart.c9
-rw-r--r--tools/ck-log-system-start.c9
-rw-r--r--tools/ck-log-system-stop.c10
-rw-r--r--tools/list-sessions.c10
-rw-r--r--tools/udev-acl.c2
11 files changed, 88 insertions, 2 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index c9c7b58..31d737e 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -41,6 +41,7 @@ AM_CFLAGS = \
-DDATADIR=\""$(datadir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLOCALSTATEDIR=\""$(localstatedir)"\" \
+ -DLOCALEDIR=\"$(localedir)\" \
$(HISTORY_CFLAGS) \
$(WARN_CFLAGS) \
$(DEBUG_CFLAGS) \
diff --git a/tools/ck-collect-session-info.c b/tools/ck-collect-session-info.c
index b803e13..7715417 100644
--- a/tools/ck-collect-session-info.c
+++ b/tools/ck-collect-session-info.c
@@ -29,6 +29,8 @@
#include <unistd.h>
#include <pwd.h>
#include <errno.h>
+#include <libintl.h>
+#include <locale.h>
#include <glib.h>
@@ -424,6 +426,14 @@ main (int argc,
{ NULL }
};
+ /* Setup for i18n */
+ setlocale(LC_ALL, "");
+
+#ifdef ENABLE_NLS
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
/* For now at least restrict this to root */
if (getuid () != 0) {
g_warning ("You must be root to run this program");
diff --git a/tools/ck-get-x11-display-device.c b/tools/ck-get-x11-display-device.c
index eb2fec9..1ceeed9 100644
--- a/tools/ck-get-x11-display-device.c
+++ b/tools/ck-get-x11-display-device.c
@@ -25,6 +25,8 @@
#include <stdlib.h>
#include <stdio.h>
+#include <libintl.h>
+#include <locale.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
@@ -160,6 +162,14 @@ main (int argc,
{ NULL }
};
+ /* Setup for i18n */
+ setlocale(LC_ALL, "");
+
+#ifdef ENABLE_NLS
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
ret = 1;
context = g_option_context_new (NULL);
diff --git a/tools/ck-get-x11-server-pid.c b/tools/ck-get-x11-server-pid.c
index 036a12a..7512ff2 100644
--- a/tools/ck-get-x11-server-pid.c
+++ b/tools/ck-get-x11-server-pid.c
@@ -28,6 +28,8 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <libintl.h>
+#include <locale.h>
#include <X11/Xlib.h>
#include <glib.h>
@@ -69,6 +71,14 @@ main (int argc,
int ret;
Display *xdisplay;
+ /* Setup for i18n */
+ setlocale(LC_ALL, "");
+
+#ifdef ENABLE_NLS
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
ret = 1;
xdisplay = display_init (&argc, &argv);
diff --git a/tools/ck-history.c b/tools/ck-history.c
index 1f9fe11..42d5498 100644
--- a/tools/ck-history.c
+++ b/tools/ck-history.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <errno.h>
+#include <libintl.h>
#include <locale.h>
#include <zlib.h>
@@ -905,6 +906,14 @@ main (int argc,
{ NULL }
};
+ /* Setup for i18n */
+ setlocale(LC_ALL, "");
+
+#ifdef ENABLE_NLS
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, entries, NULL);
retval = g_option_context_parse (context, &argc, &argv, &error);
diff --git a/tools/ck-launch-session.c b/tools/ck-launch-session.c
index 7311181..4200da8 100644
--- a/tools/ck-launch-session.c
+++ b/tools/ck-launch-session.c
@@ -42,6 +42,8 @@
#include <stdlib.h>
#include <syslog.h>
#include <unistd.h>
+#include <libintl.h>
+#include <locale.h>
#include "ck-connector.h"
@@ -54,6 +56,14 @@ main (int argc, char **argv)
pid_t pid;
int status;
+ /* Setup for i18n */
+ setlocale(LC_ALL, "");
+
+#ifdef ENABLE_NLS
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
ckc = ck_connector_new ();
if (ckc != NULL) {
dbus_error_init (&error);
diff --git a/tools/ck-log-system-restart.c b/tools/ck-log-system-restart.c
index 0b022f2..c4e1538 100644
--- a/tools/ck-log-system-restart.c
+++ b/tools/ck-log-system-restart.c
@@ -30,6 +30,7 @@
#include <sys/stat.h>
#include <string.h>
+#include <libintl.h>
#include <locale.h>
#include <glib.h>
@@ -166,6 +167,14 @@ main (int argc,
{
CkLogEvent event;
+ /* Setup for i18n */
+ setlocale(LC_ALL, "");
+
+#ifdef ENABLE_NLS
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
memset (&event, 0, sizeof (CkLogEvent));
event.type = CK_LOG_EVENT_SYSTEM_RESTART;
diff --git a/tools/ck-log-system-start.c b/tools/ck-log-system-start.c
index 229e274..1bc3a07 100644
--- a/tools/ck-log-system-start.c
+++ b/tools/ck-log-system-start.c
@@ -34,6 +34,7 @@
#include <sys/utsname.h>
#include <string.h>
+#include <libintl.h>
#include <locale.h>
#include <glib.h>
@@ -236,6 +237,14 @@ main (int argc,
CkLogSystemStartEvent *e;
struct utsname uts;
+ /* Setup for i18n */
+ setlocale(LC_ALL, "");
+
+#ifdef ENABLE_NLS
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
memset (&event, 0, sizeof (CkLogEvent));
event.type = CK_LOG_EVENT_SYSTEM_START;
diff --git a/tools/ck-log-system-stop.c b/tools/ck-log-system-stop.c
index 879402b..e9e278b 100644
--- a/tools/ck-log-system-stop.c
+++ b/tools/ck-log-system-stop.c
@@ -29,7 +29,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
-
+#include <libintl.h>
#include <locale.h>
#include <glib.h>
@@ -166,6 +166,14 @@ main (int argc,
{
CkLogEvent event;
+ /* Setup for i18n */
+ setlocale(LC_ALL, "");
+
+#ifdef ENABLE_NLS
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
memset (&event, 0, sizeof (CkLogEvent));
event.type = CK_LOG_EVENT_SYSTEM_STOP;
diff --git a/tools/list-sessions.c b/tools/list-sessions.c
index d7d004d..4ddf1e3 100644
--- a/tools/list-sessions.c
+++ b/tools/list-sessions.c
@@ -26,7 +26,7 @@
#include <sys/types.h>
#include <pwd.h>
#include <string.h>
-
+#include <libintl.h>
#include <locale.h>
#include <glib.h>
@@ -373,6 +373,14 @@ main (int argc,
{ NULL }
};
+ /* Setup for i18n */
+ setlocale(LC_ALL, "");
+
+#ifdef ENABLE_NLS
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init ();
#endif
diff --git a/tools/udev-acl.c b/tools/udev-acl.c
index 7080bc5..4f49f04 100644
--- a/tools/udev-acl.c
+++ b/tools/udev-acl.c
@@ -24,6 +24,8 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <libintl.h>
+#include <locale.h>
static int debug;