bug-gnulib
[Top][All Lists]
Advanced

[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 21:32:58 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-138-generic; KDE/5.18.0; x86_64; ; )

Hi Eli,

> > > 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.
> 
> We could have gettext work without LC_MESSAGES, by using native
> Windows calls instead, couldn't we?

That was the way it was done before Gnulib. Remember how, up to ca. 2001,
porting a program to run on DOS or Windows meant to add #ifs all over the
place?

Then Gnulib came along, with Paul's idea to implement POSIX API emulation
on non-POSIX systems. The result is successful:
  - Porting a program to run on native Windows nowadays means that 70%
    of the work is done by selecting a set of gnulib modules and adding
    a gnulib-tool invocation to the package's build system.
  - Many packages have been ported this way, with comparatively little
    #ifs.

> But LC_MESSAGES has additional impacts on systems that support it,
> beyond message catalogs and gettext, doesn't it?

While any application _can_ use LC_MESSAGES for any purposes it likes,
I haven't seen any which uses for purposes other than
  - messages
  - strings that appear in UIs
  - regular expressions that govern the validation of user input
    (yesno, rpmatch),
and all these are commonly implemented through message catalogs.

> If such calls are possible (e.g., for those who are not ardent enough
> in reading the documentation), perhaps they should be caught by Gnulib
> and flagged as errors, if they aren't already?

Such calls, e.g. setlocale(LC_ALL, "de_DE.UTF-8") on native Windows,
are possible but fail, i.e. produce the return value NULL.

A compile-time error or warning is not possible. So what else would you
expect or suggest?

> > Programs that call 'setlocale' and want to consider locale names given
> > by environment variables usually do so by calling
> >    setlocale (LC_something, "");
> 
> Which doesn't work as expected with Windows' 'setlocale', of course.

Which is precisely why the setlocale function that Gnulib provides to
applications has code to support this. (See gnulib/lib/setlocale.c
lines 832..1005.)

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]