(guess_category_value): Rewrite so that LANGUAGE value is ignored if the selected locale is the C locale.
This commit is contained in:
parent
1dc72e4ffe
commit
3859d27d73
@ -1071,39 +1071,41 @@ guess_category_value (category, categoryname)
|
||||
int category;
|
||||
const char *categoryname;
|
||||
{
|
||||
const char *language;
|
||||
const char *retval;
|
||||
|
||||
/* The highest priority value is the `LANGUAGE' environment
|
||||
variable. This is a GNU extension. */
|
||||
retval = getenv ("LANGUAGE");
|
||||
if (retval != NULL && retval[0] != '\0')
|
||||
return retval;
|
||||
variable. But we don't use the value if the currently selected
|
||||
locale is the C locale. This is a GNU extension. */
|
||||
language = getenv ("LANGUAGE");
|
||||
if (language != NULL && language[0] == '\0')
|
||||
language = NULL;
|
||||
|
||||
/* `LANGUAGE' is not set. So we have to proceed with the POSIX
|
||||
methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some
|
||||
systems this can be done by the `setlocale' function itself. */
|
||||
/* We have to proceed with the POSIX methods of looking to `LC_ALL',
|
||||
`LC_xxx', and `LANG'. On some systems this can be done by the
|
||||
`setlocale' function itself. */
|
||||
#if defined _LIBC || (defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL)
|
||||
return setlocale (category, NULL);
|
||||
retval = setlocale (category, NULL);
|
||||
#else
|
||||
/* Setting of LC_ALL overwrites all other. */
|
||||
retval = getenv ("LC_ALL");
|
||||
if (retval != NULL && retval[0] != '\0')
|
||||
return retval;
|
||||
|
||||
/* Next comes the name of the desired category. */
|
||||
retval = getenv (categoryname);
|
||||
if (retval != NULL && retval[0] != '\0')
|
||||
return retval;
|
||||
|
||||
/* Last possibility is the LANG environment variable. */
|
||||
retval = getenv ("LANG");
|
||||
if (retval != NULL && retval[0] != '\0')
|
||||
return retval;
|
||||
|
||||
/* We use C as the default domain. POSIX says this is implementation
|
||||
defined. */
|
||||
return "C";
|
||||
if (retval == NULL || retval[0] == '\0')
|
||||
{
|
||||
/* Next comes the name of the desired category. */
|
||||
retval = getenv (categoryname);
|
||||
if (retval == NULL || retval[0] == '\0')
|
||||
{
|
||||
/* Last possibility is the LANG environment variable. */
|
||||
retval = getenv ("LANG");
|
||||
if (retval == NULL || retval[0] == '\0')
|
||||
/* We use C as the default domain. POSIX says this is
|
||||
implementation defined. */
|
||||
return "C";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return language != NULL && strcmp (retval, "C") != 0 ? language : retval;
|
||||
}
|
||||
|
||||
/* @@ begin of epilog @@ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user