bug-gnu-utils
[Top][All Lists]
Advanced

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

"_(" and "N_(" convenience macros not being recognized


From: David Bruce
Subject: "_(" and "N_(" convenience macros not being recognized
Date: Tue, 9 Jun 2009 11:51:37 -0500

Hi,

Sorry if my actual problem has more to do with getting preprocessor
macros to work as intended than with gettext per se.

Also, I realize this is not a bug report, but my understanding is that
this is the list where programmers' issues with gettext can be
discussed.

I maintain two packages that use GNU gettext.  In one of the packages,
I cannot get the suggested convenience string-marking macros to work.
Text marked with "gettext ("To be translated")" gets handled
correctly, but text marked with "_("doesn't get translated")" fails to
be translated.  Similarly, "gettext_noop()" works but not "N_()".

All the C files with translatable strings have "#include globals.h" to
bring in the needed gettext-related defines.
They are listed appropriately in POTFILES.in, and the translations
exist in the po files.

globals.h has (among other things) the following lines:

#include "config.h"

// Translation stuff:
#include "gettext.h"
#include <locale.h>
#include <iconv.h>
#include <libintl.h>
#define _(String) gettext (String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)

So, the needed #defines should be there, but it doesn't work.  For
testing, I've tried placing "#define _(String) gettext (String)"
immediately before the "_()" function call instead of relying on the
"#include globals.h" directive, with no effect.

Any pitfalls I should be aware of in trying to get this working?  This
is maddening because everything works fine in the other project, which
is organized similarly, and AFAICT is doing everything just the same
as far as gettext is concerned.

Thanks for any suggestions,

David Bruce




reply via email to

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