GNOME Bugzilla – Bug 143336
gnome-app-helper.h and the N_() macro.
Last modified: 2008-09-16 14:45:32 UTC
If including gnome-app-helper.h, the N_() macro is undefined. IMHO, either the docs should mention that or gnome-app-helper should contain something like #define ENABLE_NLS 1 #include <gnome.h>
#include <gnome.h> is not the right thing since that file is deprecated from 2.x on IIRC. #include <libgnome/libgnome.h> is probably better?
I added bonobo-i18n.h to get the N_() macro.
After this change some modules have started to fail build. This is the make output for slab ##################### In file included from /opt/gnome2/include/glib-2.0/glib/gi18n.h:23, from app-shell.c:26: /usr/include/libintl.h:40: error: expected identifier or '(' before 'const' /usr/include/libintl.h:45: error: expected identifier or '(' before 'const' /usr/include/libintl.h:52: error: expected identifier or '(' before 'const' /usr/include/libintl.h:83: error: expected identifier or '(' before 'const' /usr/include/libintl.h:87: error: expected identifier or '(' before 'const' /usr/include/libintl.h:92: error: expected identifier or '(' before 'const' In file included from app-shell.c:26: /opt/gnome2/include/glib-2.0/glib/gi18n.h:25:1: warning: "_" redefined In file included from /opt/gnome2/include/libgnomeui-2.0/libgnomeui/gnome-app-helper.h:43, from /opt/gnome2/include/libgnomeui-2.0/libgnomeui/libgnomeui.h:35, from app-shell.c:22: /opt/gnome2/include/libbonobo-2.0/bonobo/bonobo-i18n.h:69:1: warning: this is the location of the previous definition make[3]: *** [app-shell.lo] Error 1 make[3]: Leaving directory `/home/luca/cvs/gnome2/slab/libslab' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/luca/cvs/gnome2/slab/libslab' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/luca/cvs/gnome2/slab' make: *** [all] Error 2 ###################################### Another application is NetworkManager. Both modules provide #include <glib/gi18n.h> in failing C source.
Confirming the regression; reopening.
I guess we should just define N_() in the header just like we do for D_() and L_()?
Yes, I guess that should work.
Like this? Index: gnome-app-helper.h =================================================================== --- gnome-app-helper.h (revisjon 5485) +++ gnome-app-helper.h (arbeidskopi) @@ -541,9 +541,11 @@ #ifdef ENABLE_NLS #define D_(x) dgettext (GETTEXT_PACKAGE, x) #define L_(x) gnome_app_helper_gettext(x) +#define N_(x) x #else #define D_(x) x #define L_(x) x +#define N_(x) x #endif
Yes.
That made nautilus compile break with a redefinition of N_() from gi18n.h. Adding gi18n-lib.h to gnome-app-helper.h breaks with a message saying that GETTEXT_PACKAGE should be defined before including that... Round and round we go. Any ideas on how to fix this or should we just leave it?
I guess we should just give up on this.
Agreed.