This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Comment about use of dgettext()
- To: binutils at sourceware dot cygnus dot com
- Subject: Comment about use of dgettext()
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Wed, 31 May 2000 11:30:59 -0700
Hi Guys,
I am going to check in the patch below which adds a comment to the
BFD and OPCODES directories explaining why dgettext() is used
instead of gettext() in the internationalisation macros.
Cheers
Nick
2000-05-31 Nick Clifton <nickc@cygnus.com>
* opintl.h (_(String)): Explain why dgettext is used instead
of gettext.
Index: bfd/sysdep.h
===================================================================
RCS file: /cvs/src//src/bfd/sysdep.h,v
retrieving revision 1.2
diff -p -r1.2 sysdep.h
*** sysdep.h 2000/05/26 13:11:55 1.2
--- sysdep.h 2000/05/31 18:29:52
*************** extern char *getenv ();
*** 126,131 ****
--- 126,143 ----
#ifdef ENABLE_NLS
#include <libintl.h>
+ /* Note the use of dgetext() and PACKAGE here, rather than gettext().
+
+ This is because the code in this directory is used to build a library which
+ will be linked with code in other directories to form programs. We want to
+ maintain a seperate translation file for this directory however, rather
+ than being forced to merge it with that of any program linked to libbfd.
+ This is a library, so it cannot depend on the catalog currently loaded.
+
+ In order to do this, we have to make sure that when we extract messages we
+ use the OPCODES domain rather than the domain of the program that included
+ the bfd library, (eg OBJDUMP). Hence we use dgettext (PACKAGE, String)
+ and define PACKAGE to be 'bfd'. (See the code in configure). */
#define _(String) dgettext (PACKAGE, String)
#ifdef gettext_noop
#define N_(String) gettext_noop (String)
Index: opcodes/opintl.h
===================================================================
RCS file: /cvs/src//src/opcodes/opintl.h,v
retrieving revision 1.3
diff -p -r1.3 opintl.h
*** opintl.h 2000/05/30 21:04:24 1.3
--- opintl.h 2000/05/31 18:29:52
***************
*** 12,17 ****
--- 12,30 ----
#ifdef ENABLE_NLS
# include <libintl.h>
+ /* Note the use of dgetext() and PACKAGE here, rather than gettext().
+
+ This is because the code in this directory is used to build a library which
+ will be linked with code in other directories to form programs. We want to
+ maintain a seperate translation file for this directory however, rather
+ than being forced to merge it with that of any program linked to
+ libopcodes. This is a library, so it cannot depend on the catalog
+ currently loaded.
+
+ In order to do this, we have to make sure that when we extract messages we
+ use the OPCODES domain rather than the domain of the program that included
+ the opcodes library, (eg OBJDUMP). Hence we use dgettext (PACKAGE, String)
+ and define PACKAGE to be 'opcodes'. (See the code in configure). */
# define _(String) dgettext (PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)