[PATCH][PR server/24377] Fix mixing English and system default languages in error messages on Windows

Владимир Мартьянов vilgeforce@gmail.com
Fri Mar 29 09:39:00 GMT 2019


Using system default locale is not a good idea, user must have a way
to change message language. If somebody have to debug on chinese
Windows, he'll get Chinese messages. And this way mustn't affect any
other applications or the system itself. LC_ALL and other env.
variables will affect only gettext, not FormatMessage in the current
implementation.

пт, 29 мар. 2019 г. в 12:29, Eli Zaretskii <eliz@gnu.org>:
>
> > From: Владимир Мартьянов <vilgeforce@gmail.com>
> > Date: Fri, 29 Mar 2019 11:42:36 +0300
> > Cc: gdb-patches@sourceware.org
> >
> > Just try to use gettext with FormatMessage. I don't have idea how to
> > do it, could you please give me a code sample?
>
> I believe this is a misunderstanding of some kind, because there's
> nothing wrong with FormatMessage calls.  As you originally pointed
> out, the 4th argument to FormatMessage is zero, which means use the
> system default locale.  The problem you raised was that gdbserver has
> messages where English is hard-coded, so this makes gdbserver
> sometimes talk in English and sometimes in the default locale's
> language.
>
> My proposal was to make gdbserver _always_ talk in the current
> locale's language, which means the FormatMessage call should be left
> alone, and instead those gdbserver messages that use English
> hard-coded should be translated by using gettext.
>
> That is, instead of
>
>       error ("Error creating process \"%s%s\", (error %d): %s\n",
>              program, args, (int) err, strwinerror (err));
>
> gdbserver should use this:
>
>       error (_("Error creating process \"%s%s\", (error %d): %s\n"),
>              program, args, (int) err, strwinerror (err));
>
> A question to other GDB maintainers: does gdbserver use gettext?  Or
> is gdbserver supposed to talk to users only in English?



More information about the Gdb-patches mailing list