bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/8] Add internationalisation support to bigram but not regexprop


From: James Youngman
Subject: [PATCH 1/8] Add internationalisation support to bigram but not regexprops.
Date: Sun, 5 Jun 2011 01:11:50 +0100

* locate/bigram.c: Use libintl.h.
(main): Call bindtextdomain.
* .x-sc_bindtextdomain: Exempt lib/regexprops.c from needing to
use bindtextdomain.  The output of regexprops is intended to be
determined entirely by the properties of the GNU regex
implementation.
---
 .x-sc_bindtextdomain |    1 +
 ChangeLog            |    8 ++++++++
 locate/bigram.c      |   23 +++++++++++++++++++++++
 3 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 .x-sc_bindtextdomain

diff --git a/.x-sc_bindtextdomain b/.x-sc_bindtextdomain
new file mode 100644
index 0000000..617565a
--- /dev/null
+++ b/.x-sc_bindtextdomain
@@ -0,0 +1 @@
+lib/regexprops\.c
\ No newline at end of file
diff --git a/ChangeLog b/ChangeLog
index c68f597..798301f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-06-04  James Youngman  <address@hidden>
 
+       Add internationalisation support to bigram but not regexprops.
+       * locate/bigram.c: Use libintl.h.
+       (main): Call bindtextdomain.
+       * .x-sc_bindtextdomain: Exempt lib/regexprops.c from needing to
+       use bindtextdomain.  The output of regexprops is intended to be
+       determined entirely by the properties of the GNU regex
+       implementation.
+
        Update gnulib.
        * gnulib: update to current head.
 
diff --git a/locate/bigram.c b/locate/bigram.c
index 32da3cc..fb17a06 100644
--- a/locate/bigram.c
+++ b/locate/bigram.c
@@ -42,6 +42,23 @@
 #include "progname.h"
 #include "closeout.h"
 
+/* We use gettext because for example xmalloc may issue an error message. */
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(Text) gettext (Text)
+#else
+# define _(Text) Text
+#define textdomain(Domain)
+#define bindtextdomain(Package, Directory)
+#endif
+#ifdef gettext_noop
+# define N_(String) gettext_noop(String)
+#else
+/* See locate.c for explanation as to why not use (String) */
+# define N_(String) String
+#endif
+
+
 /* Return the length of the longest common prefix of strings S1 and S2. */
 
 static int
@@ -67,6 +84,12 @@ main (int argc, char **argv)
   else
     set_program_name ("bigram");
 
+#ifdef HAVE_SETLOCALE
+  setlocale (LC_ALL, "");
+#endif
+  bindtextdomain (PACKAGE, LOCALEDIR);
+  textdomain (PACKAGE);
+
   (void) argc;
   atexit (close_stdout);
 
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]