On Sunday 08 February 2015 11:35:21 Giuseppe Scrivano wrote:
> Tim Rühsen <[email protected]> writes:
> >> # define ngettext(Msgid1, Msgid2, N) \
> >>
> >>     ((N) == 1 \
> >>
> >>      ? ((void) (Msgid2), (const char *) (Msgid1)) \
> >>
> >>      : ((void) (Msgid1), (const char *) (Msgid2)))
> >
> > This does not work (Kiyoshi wrote a private Mail to me).
> >
> >> Or can't we just "#include <libintl.h>" on all platforms?
> >
> > I wouldn't expect this to work everywhere.
> >
> > Another idea: how often do we use ngettext ? AFAIR, only 1 or 2 times in
> > the code. So why not remove the #define and amend those two occurrences ?

> I am quite sure we are missing some gnulib integration here, as gettext
> provided there has a similar macro.  If we have no way to build it and
> check it easily, feel free to just push your version for now.

Hurray !
Guiseppe, gnulib of course.

gnulib's gettext.h basically does the same that wget.h does, but removes the
details from wget's source code ;-)

I testet the attached patch on Solaris and Linux with and without --disable-
nls.

Please also do some testing.

Tim
From 6102133ebbf68bcb85aa0b108da7317b007468ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim Rühsen?= <[email protected]>
Date: Mon, 9 Feb 2015 10:08:19 +0100
Subject: [PATCH] gettext: Use gnulib's gettext.h for compatibility

Fixes issues with gettext on Solaris
Reported-by: Kiyoshi KANAZAWA <[email protected]>
---
 bootstrap.conf |  1 +
 src/wget.h     | 10 +---------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index 40d9e67..4fff711 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -47,6 +47,7 @@ getopt-gnu
 getpass-gnu
 getpeername
 getsockname
+gettext
 gitlog-to-changelog
 git-version-gen
 gnupload
diff --git a/src/wget.h b/src/wget.h
index 0b2381d..3a186fc 100644
--- a/src/wget.h
+++ b/src/wget.h
@@ -58,16 +58,8 @@ as that of the covered work.  */

 /* `gettext (FOO)' is long to write, so we use `_(FOO)'.  If NLS is
    unavailable, _(STRING) simply returns STRING.  */
-#if ENABLE_NLS
-# include <libintl.h>
+#include "gettext.h"
 # define _(STRING) gettext(STRING)
-#else
-# ifdef solaris
-#  include <libintl.h>
-# endif
-# define _(STRING) STRING
-# define ngettext(STRING1,STRING2,N) STRING2
-#endif

 /* A pseudo function call that serves as a marker for the automated
    extraction of messages, but does not call gettext().  The run-time
--
2.1.4

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to