summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/gettext.texi14
-rw-r--r--lib/ChangeLog5
-rw-r--r--lib/gettext.h13
4 files changed, 25 insertions, 12 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 677f32d..232cf12 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2002-01-12 Bruno Haible <bruno@clisp.org>
+
+ * gettext.texi: Remove the parentheses around the expansions of N_ and
+ gettext_noop.
+
2002-01-14 Bruno Haible <bruno@clisp.org>
* gettext.texi (c-format): Slight reformulation.
diff --git a/doc/gettext.texi b/doc/gettext.texi
index c863bdf..43cff90 100644
--- a/doc/gettext.texi
+++ b/doc/gettext.texi
@@ -704,7 +704,7 @@ or in a central header file:
@example
@group
#define _(String) (String)
-#define N_(String) (String)
+#define N_(String) String
#define textdomain(Domain)
#define bindtextdomain(Package, Directory)
@end group
@@ -719,7 +719,7 @@ simply replace these definitions by the following:
@group
#include <libintl.h>
#define _(String) gettext (String)
-#define gettext_noop(String) (String)
+#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
@end group
@end example
@@ -1858,7 +1858,7 @@ from the array. So one solution can look like this:
@example
@group
-#define gettext_noop(String) (String)
+#define gettext_noop(String) String
@{
static const char *messages[] = @{
@@ -1886,7 +1886,7 @@ with the following one:
@example
@group
-#define gettext_noop(String) (String)
+#define gettext_noop(String) String
@{
static const char *messages[] = @{
@@ -1904,11 +1904,9 @@ with the following one:
@end group
@end example
-But this has some drawbacks. First the programmer has to take care that
+But this has a drawback. The programmer has to take care that
he uses @code{gettext_noop} for the string @code{"a default message"}.
A use of @code{gettext} could have in rare cases unpredictable results.
-The second reason is found in the internals of the GNU @code{gettext}
-Library which will make this solution less efficient.
One advantage is that you need not make control flow analysis to make
sure the output is really translated in any case. But this analysis is
@@ -4230,7 +4228,7 @@ The same procedure can be done for the @code{gettext_noop} invocations
no-op macro. So you should consider the following code for your project:
@example
-#define gettext_noop(String) (String)
+#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
@end example
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 02ab0a5..1ff942d 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,8 @@
+2002-01-12 Bruno Haible <bruno@clisp.org>
+
+ * gettext.h (gettext_noop): Remove the parentheses around the
+ expansion.
+
2002-01-10 Bruno Haible <bruno@clisp.org>
* liballoca.h: Fix typo.
diff --git a/lib/gettext.h b/lib/gettext.h
index 9a67f2d..ea67f30 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -47,8 +47,13 @@
#endif
-/* For automatical extraction of messages sometimes no real
- translation is needed. Instead the string itself is the result. */
-#define gettext_noop(Str) (Str)
+/* A pseudo function call that serves as a marker for the automated
+ extraction of messages, but does not call gettext(). The run-time
+ translation is done at a different place in the code.
+ The argument, String, should be a literal string. Concatenated strings
+ and other string expressions won't work.
+ The macro's expansion is not parenthesized, so that it is suitable as
+ initializer for static 'char[]' or 'const char[]' variables. */
+#define gettext_noop(String) String
#endif /* _LIBGETTEXT_H */