In a testdir of the modules nstrftime and c-nstrftime, I see a test failure of test-nstrftime-2.sh, in particular with this output:
Format as ISO 8601: 2017-10-26 06:40:03.123456789 %a directive: Thu ../../gltests/test-nstrftime.h:393: assertion 'STREQ (buf, "jeu.") || STREQ (buf, "Jeu")' failed This shows that the internationalization is not working here. The cause is that the setlocale() function here is not overridden by gnulib, and the native Windows setlocale() function, when called with "" argument, ignores the LC_ALL environment variable. This patch fixes it. 2024-05-27 Bruno Haible <br...@clisp.org> tests: Fix internationalization problems on native Windows. * doc/posix-functions/setlocale.texi: Clarify the deficiency of setlocale() on native Windows. * modules/c-nstrftime-tests (Depends-on): Add setlocale. * modules/dfa-tests (Depends-on): Likewise. * modules/hard-locale-tests (Depends-on): Likewise. * modules/localcharset-tests (Depends-on): Likewise. * modules/nstrftime-tests (Depends-on): Likewise. diff --git a/doc/posix-functions/setlocale.texi b/doc/posix-functions/setlocale.texi index 6e232200f8..2798e224cb 100644 --- a/doc/posix-functions/setlocale.texi +++ b/doc/posix-functions/setlocale.texi @@ -9,9 +9,9 @@ Portability problems fixed by Gnulib module @code{setlocale}: @itemize @item -On Windows platforms (excluding Cygwin), @code{setlocale(@var{category},NULL)} -ignores the environment variables @code{LC_ALL}, @code{@var{category}}, and -@code{LANG}. +On Windows platforms (excluding Cygwin), @code{setlocale(@var{category},"")} +and @code{setlocale(@var{category},NULL)} both ignore the environment variables +@code{LC_ALL}, @code{@var{category}}, and @code{LANG}. @item On Windows platforms (excluding Cygwin) and Cygwin 1.5.x, @code{setlocale(LC_ALL,@var{name})} succeeds and sets the LC_CTYPE category to diff --git a/modules/c-nstrftime-tests b/modules/c-nstrftime-tests index fda810d09b..82d0a43d54 100644 --- a/modules/c-nstrftime-tests +++ b/modules/c-nstrftime-tests @@ -11,6 +11,7 @@ Depends-on: atoll c99 intprops +setlocale strerror configure.ac: diff --git a/modules/dfa-tests b/modules/dfa-tests index 53049cee4c..d27113168a 100644 --- a/modules/dfa-tests +++ b/modules/dfa-tests @@ -11,6 +11,7 @@ stdlib string unistd regex +setlocale test-framework-sh configure.ac: diff --git a/modules/hard-locale-tests b/modules/hard-locale-tests index e4bc65a256..cac960621f 100644 --- a/modules/hard-locale-tests +++ b/modules/hard-locale-tests @@ -4,6 +4,7 @@ tests/locale.c m4/musl.m4 Depends-on: +setlocale configure.ac: gl_MUSL_LIBC diff --git a/modules/localcharset-tests b/modules/localcharset-tests index cb84f2cdc7..3f2dde6dfd 100644 --- a/modules/localcharset-tests +++ b/modules/localcharset-tests @@ -2,6 +2,7 @@ Files: tests/test-localcharset.c Depends-on: +setlocale configure.ac: diff --git a/modules/nstrftime-tests b/modules/nstrftime-tests index 24212a4f84..b5c6ac2fa5 100644 --- a/modules/nstrftime-tests +++ b/modules/nstrftime-tests @@ -12,6 +12,7 @@ Depends-on: atoll c99 intprops +setlocale strerror configure.ac: