Accept locale environment variables that do not contain territory.

Locale environment variables (LC_ALL, LC_CTYPE, LANG) must contain language,
and may contain territory and encoding. Don't accidentally require territory
as that will cause fontconfig to fall back to 'en'.
This commit is contained in:
Keith Packard 2006-09-09 10:04:42 -07:00
parent f6cfbe16bf
commit 5d2f7a9d92
1 changed files with 16 additions and 0 deletions

View File

@ -91,6 +91,22 @@ FcGetDefaultLang (void)
lang_local[lang_len + 1 + territory_len] = '\0';
}
}
else
{
after = strchr (ctype, '.');
if (!after)
{
after = strchr (ctype, '@');
if (!after)
after = ctype + strlen (ctype);
}
lang_len = after - ctype;
if (lang_len + 1 <= (int) sizeof (lang_local))
{
strncpy (lang_local, ctype, lang_len);
lang_local[lang_len] = '\0';
}
}
}
/* set default lang to en */