* RFA: start of i18n
@ 2002-06-21 10:10 Tom Tromey
2002-06-21 10:22 ` Andrew Cagney
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Tom Tromey @ 2002-06-21 10:10 UTC (permalink / raw)
To: gdb-patches
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
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* 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 <unistd.h>
#endif
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# 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
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: RFA: start of i18n
2002-06-21 10:10 RFA: start of i18n Tom Tromey
@ 2002-06-21 10:22 ` Andrew Cagney
2002-06-21 10:49 ` Tom Tromey
2002-06-21 10:46 ` Elena Zannoni
2002-06-22 15:24 ` [patch] Update selftest.exp; Was: " Andrew Cagney
2 siblings, 1 reply; 17+ messages in thread
From: Andrew Cagney @ 2002-06-21 10:22 UTC (permalink / raw)
To: tromey; +Cc: gdb-patches
> 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.
I guess your stepping up to take the bat on this one (a nice suprise).
Can you perhaphs sketch out exactly what internationalizing GDB is going
to entail? So people, including me, can understand what we can expect
to be comming our way.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFA: start of i18n
2002-06-21 10:22 ` Andrew Cagney
@ 2002-06-21 10:49 ` Tom Tromey
2002-06-21 12:06 ` Andrew Cagney
0 siblings, 1 reply; 17+ messages in thread
From: Tom Tromey @ 2002-06-21 10:49 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
>>>>> "Andrew" == Andrew Cagney <ac131313@cygnus.com> writes:
Andrew> I guess your stepping up to take the bat on this one (a nice
Andrew> suprise).
Well, I'm not going to commit to it. But I thought I could make some
useful progress even if I can't do it all.
Andrew> Can you perhaphs sketch out exactly what internationalizing
Andrew> GDB is going to entail? So people, including me, can
Andrew> understand what we can expect to be comming our way.
Sure, no problem.
There are many places in gdb that could be made i18n-aware. This
patch only addresses the start of one of them: translating the
messages printed by gdb into the user's native language. The idea
here is that "help foo" would print the help in German, or French, or
Farsi, according to the locale.
In the GNU world this is done with a message catalog tool called
gettext. Gettext works using source markup of the actual text strings
(some tools use tokens or numbers the gettext manual has a nice
rationale for why its approach is superior).
There are basically 3 parts to gettextizing an application:
* The code infrastructure (this patch)
* The build infrastructure. This would be the omnipresent `po'
directory, `.pot' files, and accompanying Makefile hacks. I haven't
done this part for gdb yet. You can look in bfd/, gas/, etc, to see
how this is done. (Actually I suppose there are several plausible
ways to do it, but for gdb it seems easiest to follow what the rest
of the binutils do.)
* Marking all the strings. This is the bulk of the work. The idea
here is that whenever gdb prints a message:
printf ("Hi\n");
You must wrap the string so that (1) xgettext can extract the string
and put it into the message catalog, and (2) at runtime the string
will be translated:
printf (_("Hi\n"));
In gdb we'll be using the `gettext' function to do this
translation. But it is typical in GNU programs to define `_' as a
macro instead. This is shorter and doesn't confuse the source as
much. (My patch adds this macro.)
I haven't investigated this particular issue in gdb in too much
depth. So for instance I don't know how marking will or will not
affect MI.
I do know, from the last time I looked at gettextizing gdb (that
would have been April 98) that parts of gdb aren't i18n-safe. For
instance, add_show_from_set is not. This means that as part of the
work marking strings, some code changes will have to be made.
(Or something else will have to be done; for instance you could
imagine an ugly implementation where we have a translated sed
expression that is run over the `set' help text. I don't know
whether that would actually work though.)
Exactly what changes will need to be made is hard to predict.
If you look at the ChangeLog-9899 for bfd/gas/ld/..., you can see
what I had to do for those. Generally speaking it isn't very much,
just reworking computed printf()s and stuff like that. For
instance, something like this isn't safe:
printf ("No such %s %s\n", is_var ? "variable" : "macro", name);
That's because in other languages things may need different
orderings, or different endings in different contexts, etc. So here
you'd typically rewrite this as an `if' and two `printf's.
There's a long section on this in the gettext manual that explains
it well.
Maintenance-wise there are also some things to be aware of.
Only the first one is difficult.
* When new strings are added, they must be marked.
This is a coding style change and unfortunately isn't really
automatable.
* You have to regenerate the primary message catalog whenever strings
are added, changed, or deleted.
* You have to periodically send the master catalog to the appropriate
site so that translation teams can work on it. I know some projects
(Gnome) try to do a string freeze before a release so that the
translation teams can catch up.
* You have to periodically incorporate new translation catalogs from
the translation teams into the source repository.
A couple other ways gdb could be made i18n-aware, plus my comments:
* gdb could be aware of the encoding of strings in the inferior, and
convert to the correct output encoding when printing. In some
situations this might be nice. I don't plan to look at this.
* In theory gdb commands could be translated. However, I think there
is some consensus that in general translating commands and arguments
is too difficult in practice. I don't think anybody is doing this,
so for now I think gdb should not either. (For instance: program
names and command-line arguments aren't translated, Emacs function
names aren't translated.)
Tom
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: RFA: start of i18n
2002-06-21 10:49 ` Tom Tromey
@ 2002-06-21 12:06 ` Andrew Cagney
2002-06-21 13:13 ` Tom Tromey
0 siblings, 1 reply; 17+ messages in thread
From: Andrew Cagney @ 2002-06-21 12:06 UTC (permalink / raw)
To: tromey; +Cc: gdb-patches
> "Andrew" == Andrew Cagney <ac131313@cygnus.com> writes:
> I do know, from the last time I looked at gettextizing gdb (that
> would have been April 98) that parts of gdb aren't i18n-safe. For
> instance, add_show_from_set is not. This means that as part of the
I recently added that to the ARI. That should at least help to stop it
spreading.
I suspect GDB is going to have some fun with ui-out. Some messages are
not contigious strings but rather a concatenation of several strings.
> Maintenance-wise there are also some things to be aware of.
> Only the first one is difficult.
>
> * When new strings are added, they must be marked.
> This is a coding style change and unfortunately isn't really
> automatable.
Hopefully checking it can be automated. Sounds like we'll be needing to
be more careful with message formats and the like.
> * You have to regenerate the primary message catalog whenever strings
> are added, changed, or deleted.
Should the primary catalogue even be kept in CVS (at least on the
trunk)? Hmm, how do things handle a situtation where the primary
catalogue gets changed but not the translated catalogs?
Given that GDB is interactive it is likely going to see more string
changes then say BINUTILS or GCC.
> * You have to periodically send the master catalog to the appropriate
> site so that translation teams can work on it. I know some projects
> (Gnome) try to do a string freeze before a release so that the
> translation teams can catch up.
>
> * You have to periodically incorporate new translation catalogs from
> the translation teams into the source repository.
>
>
> A couple other ways gdb could be made i18n-aware, plus my comments:
>
> * gdb could be aware of the encoding of strings in the inferior, and
> convert to the correct output encoding when printing. In some
> situations this might be nice. I don't plan to look at this.
>
> * In theory gdb commands could be translated. However, I think there
> is some consensus that in general translating commands and arguments
> is too difficult in practice. I don't think anybody is doing this,
> so for now I think gdb should not either. (For instance: program
> names and command-line arguments aren't translated, Emacs function
> names aren't translated.)
more fun!
thanks,
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFA: start of i18n
2002-06-21 12:06 ` Andrew Cagney
@ 2002-06-21 13:13 ` Tom Tromey
2002-06-22 2:47 ` Eli Zaretskii
0 siblings, 1 reply; 17+ messages in thread
From: Tom Tromey @ 2002-06-21 13:13 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
Andrew> I suspect GDB is going to have some fun with ui-out. Some
Andrew> messages are not contigious strings but rather a concatenation
Andrew> of several strings.
Yeah, that could hurt.
Andrew> Should the primary catalogue even be kept in CVS (at least on
Andrew> the trunk)?
It depends. It is in bfd (etc) because, back in the day, I put
gettext into maintainer-tools (a Cygnus internal thing for those who
don't know), and the policy was that you didn't need maintainer-tools
to do an ordinary build. That decision lives on in the rest of the
src tree. Doing it that way is definitely easiest. It doesn't seem
notably difficult.
Andrew> Hmm, how do things handle a situtation where the primary
Andrew> catalogue gets changed but not the translated catalogs?
You just ignore it. When you upload a new primary catalog to the
translation site, the translation teams get email. Then they use
their tools (which are also part of gettext) to merge the new
translations. I think these tools also help you find out which
translations changed just a little (e.g. if a typo is fixed in English
it requires a minor change in the translated version) or were removed.
gettext always falls back to whatever is in the source (English) if it
can't find a given translation. So shipping an incomplete .po file is
not fatal; this happens all the time in fact.
This is why Gnome has a string freeze before release. It lets the
active translation teams ensure 100% coverage, by having some time for
the upload/translate/download cycle of translation. Whether gdb will
need this is hard to say in advance.
Andrew> Given that GDB is interactive it is likely going to see more
Andrew> string changes then say BINUTILS or GCC.
gcc error messages seem to churn constantly :-).
But, yeah, I'd expect even more in gdb land.
Anyway, back to the patch: it is pretty short and I think
uncontroversial. It seems unlikely to break the build, given that
very similar code is already littered throughout the src tree.
Could someone approve it in its entirety?
Tom
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFA: start of i18n
2002-06-21 13:13 ` Tom Tromey
@ 2002-06-22 2:47 ` Eli Zaretskii
2002-06-22 8:51 ` Andrew Cagney
0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2002-06-22 2:47 UTC (permalink / raw)
To: tromey; +Cc: ac131313, gdb-patches
> From: Tom Tromey <tromey@redhat.com>
> Date: 21 Jun 2002 14:26:29 -0600
>
> This is why Gnome has a string freeze before release. It lets the
> active translation teams ensure 100% coverage, by having some time for
> the upload/translate/download cycle of translation. Whether gdb will
> need this is hard to say in advance.
Speaking as a translator, freezing the strings before the release is a
good practice. It would be nice if GDB followed it.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFA: start of i18n
2002-06-22 2:47 ` Eli Zaretskii
@ 2002-06-22 8:51 ` Andrew Cagney
2002-06-22 10:25 ` Eli Zaretskii
0 siblings, 1 reply; 17+ messages in thread
From: Andrew Cagney @ 2002-06-22 8:51 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: tromey, gdb-patches
> From: Tom Tromey <tromey@redhat.com>
>> Date: 21 Jun 2002 14:26:29 -0600
>>
>> This is why Gnome has a string freeze before release. It lets the
>> active translation teams ensure 100% coverage, by having some time for
>> the upload/translate/download cycle of translation. Whether gdb will
>> need this is hard to say in advance.
>
>
> Speaking as a translator, freezing the strings before the release is a
> good practice. It would be nice if GDB followed it.
How much before? 1 week, 1 month, ... For instance:
- branch gdb
- week later, freeze strings
that leaves ~4-6 weeks.
By ``string freeze'' does that mean no new strings or, for late breaking
strings, not internationalizing them (omit the _(".."))?
Do the translators prefer to keep the trunk up-to-date or do they wait
for the release cycle?
I've no idea what sort of process the translators follow or prefer here.
enjoy,
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: RFA: start of i18n
2002-06-22 8:51 ` Andrew Cagney
@ 2002-06-22 10:25 ` Eli Zaretskii
2002-06-26 20:15 ` Andrew Cagney
0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2002-06-22 10:25 UTC (permalink / raw)
To: ac131313; +Cc: tromey, gdb-patches
> Date: Sat, 22 Jun 2002 11:51:03 -0400
> From: Andrew Cagney <ac131313@cygnus.com>
> >
> > Speaking as a translator, freezing the strings before the release is a
> > good practice. It would be nice if GDB followed it.
>
> How much before? 1 week, 1 month, ...
A couple of weeks at least. It depends on the number of messages to
translate, but I expect GDB to have a lot of them.
> - branch gdb
> - week later, freeze strings
>
> that leaves ~4-6 weeks.
That might not be a good idea, since freezing strings only a week
after the branch is too early; chances are later changes will have to
modify the messages to some extent.
It's better to leave 2 weeks extra between the day you are confident
a release is ready and the actual release. Then just resync with the
Translation Project database before you tar the release.
> By ``string freeze'' does that mean no new strings or, for late breaking
> strings, not internationalizing them (omit the _(".."))?
Yes, it means that translatable strings will not be added or modified
after the string freze.
> Do the translators prefer to keep the trunk up-to-date or do they wait
> for the release cycle?
They wait for a new version of the catalog (po/gdb.pot) file to be
submitted to the Translation Project Robot. Then they update their
translations and submit them to the Robot.
> I've no idea what sort of process the translators follow or prefer here.
See
http://www.iro.umontreal.ca/contrib/po/HTML/
It's all there.
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: RFA: start of i18n
2002-06-22 10:25 ` Eli Zaretskii
@ 2002-06-26 20:15 ` Andrew Cagney
0 siblings, 0 replies; 17+ messages in thread
From: Andrew Cagney @ 2002-06-26 20:15 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: ac131313, tromey, gdb-patches
> Date: Sat, 22 Jun 2002 11:51:03 -0400
>> From: Andrew Cagney <ac131313@cygnus.com>
>
>> >
>> > Speaking as a translator, freezing the strings before the release is a
>> > good practice. It would be nice if GDB followed it.
>
>>
>> How much before? 1 week, 1 month, ...
>
>
> A couple of weeks at least. It depends on the number of messages to
> translate, but I expect GDB to have a lot of them.
>
>
>> - branch gdb
>> - week later, freeze strings
>>
>> that leaves ~4-6 weeks.
>
>
> That might not be a good idea, since freezing strings only a week
> after the branch is too early; chances are later changes will have to
> modify the messages to some extent.
>
> It's better to leave 2 weeks extra between the day you are confident
> a release is ready and the actual release. Then just resync with the
> Translation Project database before you tar the release.
Ok. Lets try it. For 5.3 (~sep) perhaphs not seriously(1), but for 6.0
(~jan).
Andrew
(1) I'm going to assume that 5.3 won't be very i18n.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFA: start of i18n
2002-06-21 10:10 RFA: start of i18n Tom Tromey
2002-06-21 10:22 ` Andrew Cagney
@ 2002-06-21 10:46 ` Elena Zannoni
2002-06-21 10:50 ` Tom Tromey
2002-06-21 15:13 ` Andrew Cagney
2002-06-22 15:24 ` [patch] Update selftest.exp; Was: " Andrew Cagney
2 siblings, 2 replies; 17+ messages in thread
From: Elena Zannoni @ 2002-06-21 10:46 UTC (permalink / raw)
To: tromey; +Cc: gdb-patches
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 <tromey@redhat.com>
>
> * 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 <unistd.h>
> #endif
>
> +#ifdef HAVE_LOCALE_H
> +# include <locale.h>
> +#endif
> +
> +#ifdef ENABLE_NLS
> +# include <libintl.h>
> +# 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
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: RFA: start of i18n
2002-06-21 10:46 ` Elena Zannoni
@ 2002-06-21 10:50 ` Tom Tromey
2002-06-21 15:13 ` Andrew Cagney
1 sibling, 0 replies; 17+ messages in thread
From: Tom Tromey @ 2002-06-21 10:50 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb-patches
>>>>> "Elena" == Elena Zannoni <ezannoni@redhat.com> writes:
Elena> Cool. The main.c part is approved.
Thanks.
Elena> Are you going to add the _("...") thingies too?
Some for certain. Whether I'll do all of them is hard to say.
Elena> Would be nice if the first translated language is Italian. :-)
Si. :-)
Tom
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: RFA: start of i18n
2002-06-21 10:46 ` Elena Zannoni
2002-06-21 10:50 ` Tom Tromey
@ 2002-06-21 15:13 ` Andrew Cagney
2002-06-21 15:57 ` Tom Tromey
1 sibling, 1 reply; 17+ messages in thread
From: Andrew Cagney @ 2002-06-21 15:13 UTC (permalink / raw)
To: tromey; +Cc: Elena Zannoni, gdb-patches
> Cool. The main.c part is approved.
And the rest. Just suggest moving:
> > +#ifdef HAVE_LOCALE_H
> > +# include <locale.h>
> > +#endif
> > +
> > +#ifdef ENABLE_NLS
> > +# include <libintl.h>
> > +# 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
> > +
to "gdb_locale.h" and then including that.
Does src/Makefile.in:all-gdb need any dependency tweaks?
_("dontforgettheaeroguardandavagoodweekend")
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: RFA: start of i18n
2002-06-21 15:13 ` Andrew Cagney
@ 2002-06-21 15:57 ` Tom Tromey
2002-06-21 16:13 ` Andrew Cagney
0 siblings, 1 reply; 17+ messages in thread
From: Tom Tromey @ 2002-06-21 15:57 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Elena Zannoni, gdb-patches
Andrew> And the rest. Just suggest moving:
Andrew> [ ... ]
Andrew> to "gdb_locale.h" and then including that.
Ok, I did that. New patch appended. I still have gdb_locale.h
included in defs.h. My rationale is that most files will eventually
want to use these macros. Is this how you'd like it to be done? If
not I can easily remove the #include from defs.h and just include it
in each .c file by need.
Andrew> Does src/Makefile.in:all-gdb need any dependency tweaks?
Not yet. That will come with the addition of the po directory.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* gdb_locale.h: New file.
* Makefile.in (GDB_CFLAGS): Define LOCALEDIR.
(defs_h): Added gdb_locale.h.
* configure, config.in: Rebuilt.
* configure.in (PACKAGE): Define.
* defs.h: Include gdb_locale.h.
* 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 22:54:14 -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.
@@ -619,7 +619,7 @@
cp_abi_h = cp-abi.h
dcache_h = dcache.h
defs_h = defs.h $(xm_h) $(tm_h) $(nm_h) config.status config.h \
- gdbarch.h ui-file.h $(INCLUDE_DIR)/gdb/signals.h
+ gdbarch.h ui-file.h $(INCLUDE_DIR)/gdb/signals.h gdb_locale.h
doublest_h = doublest.h $(floatformat_h)
dwarf2cfi_h = dwarf2cfi.h
event_loop_h = event-loop.h
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 22:54:20 -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 22:54:21 -0000
@@ -39,6 +39,8 @@
#include <unistd.h>
#endif
+#include "gdb_locale.h"
+
/* For ``enum target_signal''. */
#include "gdb/signals.h"
Index: gdb_locale.h
===================================================================
RCS file: gdb_locale.h
diff -N gdb_locale.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb_locale.h 21 Jun 2002 22:54:25 -0000
@@ -0,0 +1,46 @@
+/* GDB-friendly replacement for <locale.h>.
+ Copyright 2002 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef GDB_LOCALE_H
+#define GDB_LOCALE_H
+
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# 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
+
+#endif /* GDB_LOCALE_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 22:54:28 -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
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: RFA: start of i18n
2002-06-21 15:57 ` Tom Tromey
@ 2002-06-21 16:13 ` Andrew Cagney
2002-06-21 16:45 ` Tom Tromey
0 siblings, 1 reply; 17+ messages in thread
From: Andrew Cagney @ 2002-06-21 16:13 UTC (permalink / raw)
To: tromey; +Cc: Elena Zannoni, gdb-patches
> Andrew> And the rest. Just suggest moving:
> Andrew> [ ... ]
> Andrew> to "gdb_locale.h" and then including that.
>
> Ok, I did that. New patch appended. I still have gdb_locale.h
> included in defs.h. My rationale is that most files will eventually
> want to use these macros.
Yep!
> If
> not I can easily remove the #include from defs.h and just include it
> in each .c file by need.
>
> Andrew> Does src/Makefile.in:all-gdb need any dependency tweaks?
>
> Not yet. That will come with the addition of the po directory.
M'kay.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* [patch] Update selftest.exp; Was: RFA: start of i18n
2002-06-21 10:10 RFA: start of i18n Tom Tromey
2002-06-21 10:22 ` Andrew Cagney
2002-06-21 10:46 ` Elena Zannoni
@ 2002-06-22 15:24 ` Andrew Cagney
2002-06-22 18:13 ` Tom Tromey
2 siblings, 1 reply; 17+ messages in thread
From: Andrew Cagney @ 2002-06-22 15:24 UTC (permalink / raw)
To: tromey; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 169 bytes --]
> This causes no test suite regressions on Red Hat Linux 7.3.
Tom,
Just FYI, I ended up committing the attached - fixed a regression in
selftest.exp.
enjoy,
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 1434 bytes --]
2002-06-22 Andrew Cagney <ac131313@redhat.com>
* gdb.base/selftest.exp (do_stes_and_next): Skip calls to
setlocale, bindtextdomain and textdomain.
Index: gdb.base/selftest.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/selftest.exp,v
retrieving revision 1.3
diff -u -r1.3 selftest.exp
--- gdb.base/selftest.exp 7 Jan 2002 19:20:09 -0000 1.3
+++ gdb.base/selftest.exp 22 Jun 2002 22:10:23 -0000
@@ -52,7 +52,7 @@
gdb_reinitialize_dir $srcdir/..
- for {set count 0} {$count < 22} {incr count} {
+ for {set count 0} {$count < 26} {incr count} {
send_gdb "list\n"
gdb_expect {
-re ".*context = data.*$gdb_prompt $" {
@@ -141,6 +141,22 @@
}
-re ".*dirarg = .* xmalloc.*$gdb_prompt $" {
return
+ }
+ -re ".*setlocale .LC_MESSAGES,.*$gdb_prompt $" {
+ set description "next over setlocale LC_MESSAGES"
+ set command "next"
+ }
+ -re ".*setlocale .LC_CTYPE,.*$gdb_prompt $" {
+ set description "next over setlocale LC_CTYPE"
+ set command "next"
+ }
+ -re ".*bindtextdomain .PACKAGE, LOCALEDIR.;.*$gdb_prompt $" {
+ set description "next over bindtextdomain"
+ set command "next"
+ }
+ -re ".*textdomain .PACKAGE.;.*$gdb_prompt $" {
+ set description "next over textdomain PACKAGE"
+ set command "next"
}
-re "\[ \t\]+\{\r\n$gdb_prompt $" {
setup_xfail "mips-*-irix5*"
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2002-06-27 3:15 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-21 10:10 RFA: start of i18n Tom Tromey
2002-06-21 10:22 ` Andrew Cagney
2002-06-21 10:49 ` Tom Tromey
2002-06-21 12:06 ` Andrew Cagney
2002-06-21 13:13 ` Tom Tromey
2002-06-22 2:47 ` Eli Zaretskii
2002-06-22 8:51 ` Andrew Cagney
2002-06-22 10:25 ` Eli Zaretskii
2002-06-26 20:15 ` Andrew Cagney
2002-06-21 10:46 ` Elena Zannoni
2002-06-21 10:50 ` Tom Tromey
2002-06-21 15:13 ` Andrew Cagney
2002-06-21 15:57 ` Tom Tromey
2002-06-21 16:13 ` Andrew Cagney
2002-06-21 16:45 ` Tom Tromey
2002-06-22 15:24 ` [patch] Update selftest.exp; Was: " Andrew Cagney
2002-06-22 18:13 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox