This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH][PR server/24377] Fix mixing English and system default languages in error messages on Windows
- From: Jon Turney <jon dot turney at dronecode dot org dot uk>
- To: Владимир Мартьянов <vilgeforce at gmail dot com>, gdb-patches at sourceware dot org
- Date: Mon, 1 Apr 2019 23:08:50 +0100
- Subject: Re: [PATCH][PR server/24377] Fix mixing English and system default languages in error messages on Windows
- References: <CAL5iTPJO-WLB8a07+K_aE4fkDkr8kPewkm9wPtuYDGnkq8bWrg@mail.gmail.com> <83mullpwg6.fsf@gnu.org> <CAL5iTP+hJE6x2gk3Q3N_ikJdr-ie62vG4HwKCZCfX0HnZwyZFw@mail.gmail.com> <83ef6qjdbb.fsf@gnu.org> <CAL5iTPJr_-WxFcCSFdq_CEoBHuq22FVr55aA1WQisO9DPiEv2w@mail.gmail.com> <838swyjafd.fsf@gnu.org> <CAL5iTPJD77ML8=2uM_dc63QCSHtKrgQTZe2MQbPUoo=veAYJ3A@mail.gmail.com> <837echkgjo.fsf@gnu.org> <CAL5iTP+_iZwf+NyMXM8+xRUd4H8ibSSvTKF=e8HrQ+MbJDfv1g@mail.gmail.com> <8336n3hzkx.fsf@gnu.org> <CAL5iTP+7snxFyw4B8bfBNJtfy+B3p3kSCfdQcChmkw+gwrN5eA@mail.gmail.com>
On 31/03/2019 20:39, Владимир Мартьянов wrote:
вс, 31 мар. 2019 г. в 17:45, Eli Zaretskii <eliz@gnu.org>:
Bother: do we want to behave like a Posix platform here, or like a
Windows system? Windows doesn't have LC_MESSAGES as a locale
category.
I just saw LC_MESSAGES usage in gettext...
Having LC_MESSAGES be controlling is definitely correct for Cygwin.
I'm not sure about a MinGW build of gdb.
Finally, a more general point: I'm not sure I understand the purpose
of this change. Is the purpose to let users control the language of
the gdbserver system error messages?
Yes, it's the purprose.
I'm wondering why this problem doesn't crop up in gdb itself? Are there
no uses of FormatMessage() in that?
If so, would they need to
control that by setting environment variables? It sounds less
convenient than it could have been, I think. Why not a GDB variable
instead?
Environment variables are used in gettext anyway, I think single
source for localisation language is convenient.
I corrected issues you mentioned (I hope!) and made a function to get locale ID.
A few comments on your get_lcid() function:
- It looks like this is going to ignore LC_ALL etc. if LocaleNameToLCID
and Rfc1766ToLcidW can't found. This doesn't seem correct as the
environment variable should still have an effect.
- You're not checking all the environment variables which might control
the locale for the message locale category (See e.g. [1]). I don't think
there's any need to do this by hand, since you should be able to use the
result of setlocale(LC_MESSAGE, NULL)?
[1]
https://www.gnu.org/software/gettext/manual/html_node/Locale-Environment-Variables.html