[Top][All Lists]
[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
- [PATCH 1/8] Add internationalisation support to bigram but not regexprops.,
James Youngman <=
- [PATCH 6/8] Silence some false positives for sc_prohibit_always_true_header_tests., James Youngman, 2011/06/04
- [PATCH 8/8] Avoid some false positives for the sc_prohibit_doubled_word check., James Youngman, 2011/06/04
- [PATCH 3/8] Use the gnulib byteswap and uname modules., James Youngman, 2011/06/04
- [PATCH 2/8] gnulib already defines O_CLOEXEC., James Youngman, 2011/06/04
- [PATCH 4/8] Update xargs error message., James Youngman, 2011/06/04
- [PATCH 5/8] Prefer "cannot" to "can not"., James Youngman, 2011/06/04
- [PATCH 7/8] Include dirent.h uncontintionally (since gnulib provides it)., James Youngman, 2011/06/04