diff options
author | James Youngman <jay@gnu.org> | 2011-06-04 14:00:55 +0100 |
---|---|---|
committer | James Youngman <jay@gnu.org> | 2011-06-04 14:00:55 +0100 |
commit | e3e2d4f49e0ff3e4be9954518e038b2dd69fa4c4 (patch) | |
tree | 848f106b9518c538ff286e937c770f455ef4a81a | |
parent | b29b8d8c30c97dca3faf5faf7353a0d866b136b3 (diff) | |
download | findutils-e3e2d4f49e0ff3e4be9954518e038b2dd69fa4c4.tar.gz |
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.
-rw-r--r-- | .x-sc_bindtextdomain | 1 | ||||
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | locate/bigram.c | 23 |
3 files changed, 32 insertions, 0 deletions
diff --git a/.x-sc_bindtextdomain b/.x-sc_bindtextdomain new file mode 100644 index 00000000..617565a2 --- /dev/null +++ b/.x-sc_bindtextdomain @@ -0,0 +1 @@ +lib/regexprops\.c
\ No newline at end of file @@ -1,5 +1,13 @@ 2011-06-04 James Youngman <jay@gnu.org> + 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 32da3cc6..fb17a06e 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); |