-I$(top_srcdir)/src -I$(top_builddir)/src \
        -I$(top_srcdir)/fish -I$(top_builddir)/fish \
        -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
+       -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
        -I$(srcdir)/../gnulib/lib -I../gnulib/lib \
        $(WARN_CFLAGS) $(WERROR_CFLAGS)
 
 
 
   atexit (close_stdout);
 
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEBASEDIR);
+  textdomain (PACKAGE);
+
   enum { HELP_OPTION = CHAR_MAX + 1 };
 
   static const char *options = "a:Df:h::im:nrv?Vx";
 
        -I$(top_srcdir)/src -I$(top_builddir)/src \
        -I$(srcdir)/../gnulib/lib -I../gnulib/lib \
        -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
+       -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
        $(FUSE_CFLAGS) \
        $(WARN_CFLAGS) $(WERROR_CFLAGS)
 
 
 int
 main (int argc, char *argv[])
 {
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEBASEDIR);
+  textdomain (PACKAGE);
+
   enum { HELP_OPTION = CHAR_MAX + 1 };
 
   /* The command line arguments are broadly compatible with (a subset
 
 
 hivexml_LDADD = libhivex.la $(LIBXML2_LIBS)
 hivexml_CFLAGS = \
+  -I$(top_srcdir)/src \
+  -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
   $(LIBXML2_CFLAGS) \
   $(WARN_CFLAGS) $(WERROR_CFLAGS)
 
 
 hivexget_LDADD = libhivex.la
 hivexget_CFLAGS = \
+  -I$(top_srcdir)/src \
+  -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
   $(WARN_CFLAGS) $(WERROR_CFLAGS)
 
 man_MANS = hivex.3 hivexml.1 hivexget.1
 
 
 #include "hivex.h"
 
+#ifdef HAVE_GETTEXT
+#include "gettext.h"
+#define _(str) dgettext(PACKAGE, (str))
+//#define N_(str) dgettext(PACKAGE, (str))
+#else
+#define _(str) str
+//#define N_(str) str
+#endif
+
 enum { EXIT_NOT_FOUND = 2 };
 
 int
 main (int argc, char *argv[])
 {
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEBASEDIR);
+  textdomain (PACKAGE);
+
   if (argc < 3 || argc > 4) {
-    fprintf (stderr, "hivexget regfile path [key]\n");
+    fprintf (stderr, _("hivexget regfile path [key]\n"));
     exit (EXIT_FAILURE);
   }
+
   char *file = argv[1];
   char *path = argv[2];
   char *key = argv[3];          /* could be NULL */
 
   if (path[0] != '\\') {
-    fprintf (stderr, "hivexget: path must start with a \\ character\n");
+    fprintf (stderr, _("hivexget: path must start with a \\ character\n"));
     exit (EXIT_FAILURE);
   }
   if (path[1] == '\\') {
   doubled:
-    fprintf (stderr, "hivexget: %s: \\ characters in path are doubled - are you escaping the path parameter correctly?\n", path);
+    fprintf (stderr, _("hivexget: %s: \\ characters in path are doubled - are you escaping the path parameter correctly?\n"), path);
     exit (EXIT_FAILURE);
   }
 
       if (errno)
         goto error;
       /* else node not found */
-      fprintf (stderr, "hivexget: %s: %s: path element not found\n",
+      fprintf (stderr, _("hivexget: %s: %s: path element not found\n"),
                path, p);
       exit (EXIT_NOT_FOUND);
     }
       if (errno)
         goto error;
       /* else key not found */
-      fprintf (stderr, "hivexget: %s: key not found\n", key);
+      fprintf (stderr, _("hivexget: %s: key not found\n"), key);
       exit (EXIT_NOT_FOUND);
     }
 
 
 
 #include "hivex.h"
 
+#ifdef HAVE_GETTEXT
+#include "gettext.h"
+#define _(str) dgettext(PACKAGE, (str))
+//#define N_(str) dgettext(PACKAGE, (str))
+#else
+#define _(str) str
+//#define N_(str) str
+#endif
+
 /* Callback functions. */
 static int node_start (hive_h *, void *, hive_node_h, const char *name);
 static int node_end (hive_h *, void *, hive_node_h, const char *name);
 #define XML_CHECK(proc, args)                                           \
   do {                                                                  \
     if ((proc args) == -1) {                                            \
-      fprintf (stderr, "%s: failed to write XML document\n", #proc);    \
-      exit (EXIT_FAILURE);                                                         \
+      fprintf (stderr, _("%s: failed to write XML document\n"), #proc); \
+      exit (EXIT_FAILURE);                                              \
     }                                                                   \
   } while (0)
 
 int
 main (int argc, char *argv[])
 {
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEBASEDIR);
+  textdomain (PACKAGE);
+
   int c;
   int open_flags = 0;
   int visit_flags = 0;
   }
 
   if (optind + 1 != argc) {
-    fprintf (stderr, "hivexml: missing name of input file\n");
+    fprintf (stderr, _("hivexml: missing name of input file\n"));
     exit (EXIT_FAILURE);
   }
 
   xmlTextWriterPtr writer;
   writer = xmlNewTextWriterFilename ("/dev/stdout", 0);
   if (writer == NULL) {
-    fprintf (stderr, "xmlNewTextWriterFilename: failed to create XML writer\n");
+    fprintf (stderr, _("xmlNewTextWriterFilename: failed to create XML writer\n"));
     exit (EXIT_FAILURE);
   }
 
 
 
 libguestfs_test_tool_SOURCES = test-tool.c
 libguestfs_test_tool_CFLAGS = \
+       -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
        -I$(top_srcdir)/src -I$(top_builddir)/src \
        -Wall
 libguestfs_test_tool_LDADD = \
 
 int
 main (int argc, char *argv[])
 {
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEBASEDIR);
+  textdomain (PACKAGE);
+
   static const char *options = "t:?";
   static const struct option long_options[] = {
     { "help", 0, 0, '?' },