mirror of
https://https.git.savannah.gnu.org/git/gettext.git
synced 2026-01-26 15:39:11 +00:00
libintl: Fix language preferences on macOS 10.12 or newer.
Reported by Kristian Rietveld <kris@loopnest.org> at <https://savannah.gnu.org/bugs/?49560>. * gettext-runtime/intl/langprefs.c (_nl_language_preferences_default): Handle preferences elements of the form "ll-CC" in a reasonable way. * NEWS: Mention the change.
This commit is contained in:
parent
b0fb6a58fa
commit
aeab87f30d
9
NEWS
9
NEWS
@ -36,10 +36,11 @@
|
||||
Free Pascal compiler version 3.0.0 or newer.
|
||||
|
||||
* Runtime behaviour:
|
||||
The replacements for the printf()/fprintf()/... functions that are
|
||||
provided through <libintl.h> on native Windows and NetBSD are now POSIX
|
||||
compliant. There is no conflict any more between these replacements
|
||||
and other possible replacements provided by gnulib or mingw.
|
||||
- The interpretation of the language preferences on macOS has been fixed.
|
||||
- The replacements for the printf()/fprintf()/... functions that are
|
||||
provided through <libintl.h> on native Windows and NetBSD are now POSIX
|
||||
compliant. There is no conflict any more between these replacements
|
||||
and other possible replacements provided by gnulib or mingw.
|
||||
|
||||
Version 0.19.8 - June 2016
|
||||
|
||||
|
||||
@ -264,12 +264,25 @@ _nl_language_preferences_default (void)
|
||||
{
|
||||
_nl_locale_name_canonicalize (buf);
|
||||
size += strlen (buf) + 1;
|
||||
/* Mac OS X 10.12 or newer returns an array of elements of
|
||||
the form "ll-CC" where ll is a language code and CC is a
|
||||
country code. _nl_locale_name_canonicalize converts this
|
||||
to "ll_CC". Sometimes ll and CC are unrelated, i.e.
|
||||
there is no translation for "ll_CC" but one for "ll".
|
||||
Therefore, in the result, we return "ll_CC" followed
|
||||
by "ll". */
|
||||
{
|
||||
char *underscore = strchr (buf, '_');
|
||||
if (underscore != NULL)
|
||||
size += (underscore - buf) + 1;
|
||||
}
|
||||
/* Most GNU programs use msgids in English and don't ship
|
||||
an en.mo message catalog. Therefore when we see "en"
|
||||
in the preferences list, arrange for gettext() to
|
||||
return the msgid, and ignore all further elements of
|
||||
an en.mo message catalog. Therefore when we see "en" or
|
||||
"en-CC" in the preferences list, arrange for gettext()
|
||||
to return the msgid, and ignore all further elements of
|
||||
the preferences list. */
|
||||
if (strcmp (buf, "en") == 0)
|
||||
if (buf[0] == 'e' && buf[1] == 'n'
|
||||
&& (buf[2] == '\0' || buf[2] == '_'))
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -297,7 +310,17 @@ _nl_language_preferences_default (void)
|
||||
strcpy (p, buf);
|
||||
p += strlen (buf);
|
||||
*p++ = ':';
|
||||
if (strcmp (buf, "en") == 0)
|
||||
{
|
||||
char *underscore = strchr (buf, '_');
|
||||
if (underscore != NULL)
|
||||
{
|
||||
memcpy (p, buf, underscore - buf);
|
||||
p += underscore - buf;
|
||||
*p++ = ':';
|
||||
}
|
||||
}
|
||||
if (buf[0] == 'e' && buf[1] == 'n'
|
||||
&& (buf[2] == '\0' || buf[2] == '_'))
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user