Skip to content
Snippets Groups Projects
Commit d8bc8bcbd0cd authored by Nick Wellnhofer's avatar Nick Wellnhofer
Browse files

Support Esperanto locale

* libxslt/xsltlocale.c: only affects the glibc locale code, adds
  the "eo" language code and also try locales without territory
parent 9e95c967de61
No related branches found
No related tags found
No related merge requests found
......@@ -71,8 +71,7 @@
* @languageTag: RFC 3066 language tag
*
* Creates a new locale of an opaque system dependent type based on the
* language tag. Three-letter language codes (ISO 639-2 Alpha-3) are not
* supported.
* language tag.
*
* Returns the locale or NULL on error or if no matching locale was found
*/
......@@ -80,7 +79,7 @@
xsltNewLocale(const xmlChar *languageTag) {
#ifdef XSLT_LOCALE_XLOCALE
xsltLocale locale;
char localeName[XSLTMAX_LANGTAGLEN+6]; /* 8*lang + "-" + 8*region + ".utf8\0" */
char localeName[XSLTMAX_LANGTAGLEN+6]; /* 6 chars for ".utf8\0" */
const xmlChar *p = languageTag;
const char *region = NULL;
char *q = localeName;
......@@ -115,6 +114,8 @@
if (locale != NULL)
return(locale);
/* Continue without using country code */
q = localeName + llen + 1;
}
......@@ -118,6 +119,13 @@
q = localeName + llen + 1;
}
/* Try locale without territory, e.g. for Esperanto (eo) */
memcpy(q, ".utf8", 6);
locale = newlocale(LC_COLLATE_MASK, localeName, NULL);
if (locale != NULL)
return(locale);
/* Try to find most common country for language */
if (llen != 2)
......@@ -127,6 +135,7 @@
if (region == NULL)
return(NULL);
q = localeName + llen + 1;
*q++ = region[0];
*q++ = region[1];
memcpy(q, ".utf8", 6);
......@@ -216,7 +225,7 @@
break;
case 'e':
if (c == 'l') region = "GR";
else if (c == 'n') region = "US";
else if (c == 'n' || c == 'o') region = "US";
else if (c == 's' || c == 'u') region = "ES";
else if (c == 't') region = "EE";
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment