From: Bruno Haible Date: Sat, 11 Aug 2018 15:35:51 +0000 (+0200) Subject: gettext-runtime/intl/setlocale.c: Add fixes from gnulib. X-Git-Tag: v0.20~400 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b26729c67cffb2403d8a20b44606f5a08cb901b5;p=thirdparty%2Fgettext.git gettext-runtime/intl/setlocale.c: Add fixes from gnulib. 2018-08-11 Bruno Haible setlocale: Trivial simplification. * lib/setlocale.c (setlocale_unixlike): Remove redundant #if. 2017-04-21 Bruno Haible Fix test-mbrtowc5.sh failure on native Windows. * setlocale.c (setlocale_unixlike): Accept "POSIX" as an alias for "C". 2016-03-22 Geert Janssens setlocale: add "sv" to Windows language table * setlocale.c (language_table) [W32]: Add "sv". Reported in . 2012-01-04 Bruno Haible Talk about "native Windows API", not "Win32". * setlocale.c: Update comments to mention native Windows. --- diff --git a/gettext-runtime/intl/setlocale.c b/gettext-runtime/intl/setlocale.c index df1991825..edbce091a 100644 --- a/gettext-runtime/intl/setlocale.c +++ b/gettext-runtime/intl/setlocale.c @@ -83,7 +83,7 @@ category_to_name (int category) # if defined _WIN32 && ! defined __CYGWIN__ -/* The native Win32 setlocale() function expects locale names of the form +/* The native Windows setlocale() function expects locale names of the form "German" or "German_Germany" or "DEU", but not "de" or "de_DE". We need to convert the names from the form with ISO 639 language code and ISO 3166 country code to the form with English names or with three-letter identifier. @@ -390,6 +390,7 @@ static const struct table_entry language_table[] = { "sq", "Albanian" }, { "sr", "Serbian (Latin)" }, { "sr@cyrillic", "SRB" }, /* Serbian (Cyrillic) */ + { "sv", "Swedish" }, { "sw", "Swahili" }, { "syr", "Syriac" }, { "ta", "Tamil" }, @@ -641,6 +642,11 @@ setlocale_unixlike (int category, const char *locale) char ll_buf[64]; char CC_buf[64]; + /* The native Windows implementation of setlocale understands the special + locale name "C", but not "POSIX". Therefore map "POSIX" to "C". */ + if (locale != NULL && strcmp (locale, "POSIX") == 0) + locale = "C"; + /* First, try setlocale with the original argument unchanged. */ result = setlocale (category, locale); if (result != NULL)