From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14998 invoked by alias); 21 Jun 2002 17:46:08 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 14958 invoked from network); 21 Jun 2002 17:46:02 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 21 Jun 2002 17:46:02 -0000 Received: from localhost.redhat.com (remus.sfbay.redhat.com [172.16.27.252]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id KAA18617; Fri, 21 Jun 2002 10:45:59 -0700 (PDT) Received: by localhost.redhat.com (Postfix, from userid 469) id 18D4C107D4; Fri, 21 Jun 2002 13:45:15 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15635.26155.499501.230768@localhost.redhat.com> Date: Fri, 21 Jun 2002 10:46:00 -0000 To: tromey@redhat.com Cc: gdb-patches@sources.redhat.com Subject: Re: RFA: start of i18n In-Reply-To: <87elf0wnp2.fsf@fleche.redhat.com> References: <87elf0wnp2.fsf@fleche.redhat.com> X-SW-Source: 2002-06/txt/msg00430.txt.bz2 Tom Tromey writes: > This patch adds some minor infrastructure required to let gdb use > gettext for message translation. Basically it works the same way as > gettext does in bfd, gas, ld, etc. > > No messages are actually translated at this point. This just makes it > possible to do so. > > This causes no test suite regressions on Red Hat Linux 7.3. > > Ok to commit? > > Tom > Cool. The main.c part is approved. Are you going to add the _("...") thingies too? Would be nice if the first translated language is Italian. :-) Elena > > Index: ChangeLog > from Tom Tromey > > * Makefile.in (GDB_CFLAGS): Define LOCALEDIR. > * configure, config.in: Rebuilt. > * configure.in (PACKAGE): Define. > * defs.h: Include locale.h, libintl.h. > (_, N_): Define. > * main.c (captured_main): Call setlocale, bindtextdomain, > textdomain. > > Index: Makefile.in > =================================================================== > RCS file: /cvs/src/src/gdb/Makefile.in,v > retrieving revision 1.209 > diff -u -r1.209 Makefile.in > --- Makefile.in 14 Jun 2002 22:30:41 -0000 1.209 > +++ Makefile.in 21 Jun 2002 17:02:30 -0000 > @@ -312,7 +312,7 @@ > # your system doesn't have fcntl.h in /usr/include (which is where it > # should be according to Posix). > DEFS = @DEFS@ > -GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config $(DEFS) > +GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config -DLOCALEDIR="\"$(prefix)/share/locale\"" $(DEFS) > > # M{H,T}_CFLAGS, if defined, have host- and target-dependent CFLAGS > # from the config directory. > Index: configure.in > =================================================================== > RCS file: /cvs/src/src/gdb/configure.in,v > retrieving revision 1.87 > diff -u -r1.87 configure.in > --- configure.in 11 May 2002 00:40:25 -0000 1.87 > +++ configure.in 21 Jun 2002 17:02:36 -0000 > @@ -33,10 +33,11 @@ > AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) > AC_CANONICAL_SYSTEM > > -dnl gdb doesn't use gettext, but bfd does. We call this to ensure we > -dnl link with the correct libraries. > +dnl Set up for gettext. PACKAGE is used when we call bindtextdomain. > ALL_LINGUAS= > CY_GNU_GETTEXT > +AC_DEFINE(PACKAGE, "gdb", [Name of this package. ]) > + > > dnl List of object files added by configure. > > Index: defs.h > =================================================================== > RCS file: /cvs/src/src/gdb/defs.h,v > retrieving revision 1.89 > diff -u -r1.89 defs.h > --- defs.h 15 Jun 2002 18:45:31 -0000 1.89 > +++ defs.h 21 Jun 2002 17:02:37 -0000 > @@ -39,6 +39,28 @@ > #include > #endif > > +#ifdef HAVE_LOCALE_H > +# include > +#endif > + > +#ifdef ENABLE_NLS > +# include > +# define _(String) gettext (String) > +# ifdef gettext_noop > +# define N_(String) gettext_noop (String) > +# else > +# define N_(String) (String) > +# endif > +#else > +# define gettext(Msgid) (Msgid) > +# define dgettext(Domainname, Msgid) (Msgid) > +# define dcgettext(Domainname, Msgid, Category) (Msgid) > +# define textdomain(Domainname) while (0) /* nothing */ > +# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */ > +# define _(String) (String) > +# define N_(String) (String) > +#endif > + > /* For ``enum target_signal''. */ > #include "gdb/signals.h" > > Index: main.c > =================================================================== > RCS file: /cvs/src/src/gdb/main.c,v > retrieving revision 1.16 > diff -u -r1.16 main.c > --- main.c 17 Jan 2002 22:15:17 -0000 1.16 > +++ main.c 21 Jun 2002 17:02:44 -0000 > @@ -157,6 +157,15 @@ > > long time_at_startup = get_run_time (); > > +#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) > + setlocale (LC_MESSAGES, ""); > +#endif > +#if defined (HAVE_SETLOCALE) > + setlocale (LC_CTYPE, ""); > +#endif > + bindtextdomain (PACKAGE, LOCALEDIR); > + textdomain (PACKAGE); > + > START_PROGRESS (argv[0], 0); > > #ifdef MPW