[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: localename: Fix gettext test failures on mingw
From: |
Bruno Haible |
Subject: |
Re: localename: Fix gettext test failures on mingw |
Date: |
Sat, 24 Nov 2018 12:20:21 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-138-generic; KDE/5.18.0; x86_64; ; ) |
Hi Eli,
> LC_MESSAGES means nothing on MS-Windows, so why does Gnulib need to
> "fix" something that is not supported by the runtime library?
On native Windows, LC_MESSAGES is indeed not defined by the runtime
library, but by Gnulib: it's defined in gnulib's <locale.h> replacement [1]
and supported by gnulib's 'setlocale' module.
Why do we do this?
1. Because LC_MESSAGES is defined by POSIX, and one of Gnulib's goals is
to emulate POSIX APIs, as far as it makes sense.
2. Because LC_MESSAGES is essential for GNU gettext.
> Applications that want to be portable to MinGW and use LC_MESSAGES
> should make sure the related code is either ifdef'ed out on MS-Windows
> or does something reasonable "by other means".
... where "other means" include using Gnulib's 'locale' and 'setlocale'
modules.
> Proliferating the illusion that LC_MESSAGES are supported on
> MS-Windows is IMO not a good idea.
Why not? It's a good "illusion". It's an "illusion" that allows GNU gettext
to work on native Windows.
This kind of "illusion" is the basis of the POSIX emulation part of Gnulib. [2]
> > 2018-11-23 Bruno Haible <address@hidden>
> >
> > localename: Fix gettext test failures on mingw.
> > * lib/localename.c (gl_locale_name_posix): Convert the result of
> > gl_locale_name_environ to XPG syntax.
>
> I no longer remember the details, but wouldn't such conversion get in
> the way of calling 'setlocale'? The MS-Windows runtime library
> implementation doesn't understand the XPG syntax, AFAIR, so it will
> generally fail.
Correct. Programs should not call 'setlocale' with the result of
'gl_locale_name_posix'. This follows from the documentation of
'gl_locale_name_posix' in localename.h.
Programs that call 'setlocale' and want to consider locale names given
by environment variables usually do so by calling
setlocale (LC_something, "");
Bruno
[1] https://www.gnu.org/software/gnulib/manual/html_node/locale_002eh.html
[2]
https://www.gnu.org/software/gnulib/manual/html_node/Various-Kinds-of-Modules.html#Support-for-ISO-C-or-POSIX-functions_002e
- localename: Fix gettext test failures on mingw, Bruno Haible, 2018/11/23
- Re: localename: Fix gettext test failures on mingw, Eli Zaretskii, 2018/11/24
- Re: localename: Fix gettext test failures on mingw,
Bruno Haible <=
- Re: localename: Fix gettext test failures on mingw, Eli Zaretskii, 2018/11/24
- Re: localename: Fix gettext test failures on mingw, Bruno Haible, 2018/11/24
- Re: localename: Fix gettext test failures on mingw, Eli Zaretskii, 2018/11/25
- Re: localename: Fix gettext test failures on mingw, Bruno Haible, 2018/11/25
- Re: localename: Fix gettext test failures on mingw, Eli Zaretskii, 2018/11/25
- Re: localename: Fix gettext test failures on mingw, Eli Zaretskii, 2018/11/26