Revert "Cygwin: locales: drop supporting iso639 strings as valid locales"

This reverts commit 15898b9588.

The idea behind this patch was wrong.  Systems are supposed to
support iso639-only strings as settings for the locale environment
variables, and they are not necessarily available in the
/usr/share/locale/locale.alias file.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2023-03-25 22:28:25 +01:00
parent b5b67a65f8
commit 7002f7f7c7
1 changed files with 11 additions and 2 deletions

View File

@ -127,8 +127,17 @@ __get_rfc5646_from_locale (const char *name, wchar_t *win_locale)
c = wcschr (locale, '_'); c = wcschr (locale, '_');
if (!c) if (!c)
{ {
set_errno (ENOENT); /* try if the locale can be resolved from the language tag
return -1; fix up Linux-only locale first */
if (!wcscmp (locale, L"ber"))
wcscpy (locale, L"tzm");
if (ResolveLocaleName (locale, wlocale, ENCODING_LEN + 1) <= 0)
{
set_errno (ENOENT);
return -1;
}
wcpcpy (win_locale, wlocale);
return 1;
} }
/* Convert to RFC 5646 syntax. */ /* Convert to RFC 5646 syntax. */