From 3e5322512be81527430059b901747df7692a6855 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 14 Jul 2005 17:59:15 +0000 Subject: Localisation --- src/rcclocale.c | 11 +++++++---- src/rccstring.c | 2 +- src/rccxml.c | 22 ++++++++++++---------- 3 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/rcclocale.c b/src/rcclocale.c index 838dfd6..9095bca 100644 --- a/src/rcclocale.c +++ b/src/rcclocale.c @@ -41,11 +41,14 @@ int rccLocaleGetLanguage(char *result, const char *lv, unsigned int n) { locale_class = rccLocaleGetClassByName(lv); if (locale_class >= 0) { l = setlocale(locale_class, NULL); - if (!l) return -1; - else if ((strcmp(l,"C")==0)||(strcmp(l,"POSIX")==0)) return -1; - } else return -1; + } else { + if (!strcasecmp(lv, "LANG")) l = getenv("LANG"); + else if (!strcasecmp(lv, "LANGUAGE")) l = getenv("LANGUAGE"); + else l = NULL; + } + if ((!l)||(strcmp(l,"C")==0)||(strcmp(l,"POSIX")==0)) return -1; - for (i=0;((l[i])&&(l[i]!='.'));i++); + for (i=0;((l[i])&&(l[i]!='.')&&(l[i]!=':'));i++); for (j=0;rcc_default_aliases[j].alias;j++) if (strncmp(l,rcc_default_aliases[j].alias,i)==0) { diff --git a/src/rccstring.c b/src/rccstring.c index f1f7016..d520693 100644 --- a/src/rccstring.c +++ b/src/rccstring.c @@ -48,7 +48,7 @@ int rccStringFixID(rcc_string string, rcc_context ctx) { language_id = rccGetLanguageByName(ctx, lang); if ((language_id == (rcc_language_id)-1)||(language_id == 0)) return -1; - config = rccGetLanguageConfig(ctx, language_id); + config = rccGetConfig(ctx, language_id); if (!config) return -1; header->language_id = language_id; diff --git a/src/rccxml.c b/src/rccxml.c index 5e60731..b7cc1d8 100644 --- a/src/rccxml.c +++ b/src/rccxml.c @@ -118,17 +118,19 @@ int rccXmlInit(int LoadConfiguration) { } } - rcc_default_languages[pos].sn = lang; - rcc_default_languages[pos].charsets[0] = rcc_default_charset; - if (cpos > 1) rcc_default_languages[pos].charsets[cpos] = NULL; - else { - rcc_default_languages[pos].charsets[1] = rcc_utf8_charset; - rcc_default_languages[pos].charsets[2] = NULL; - } - rcc_default_languages[pos].engines[0] = &rcc_default_engine; - rcc_default_languages[pos].engines[epos] = NULL; + if ((cpos > 1)||(epos > 1)) { + rcc_default_languages[pos].sn = lang; + rcc_default_languages[pos].charsets[0] = rcc_default_charset; + if (cpos > 1) rcc_default_languages[pos].charsets[cpos] = NULL; + else { + rcc_default_languages[pos].charsets[1] = rcc_utf8_charset; + rcc_default_languages[pos].charsets[2] = NULL; + } + rcc_default_languages[pos].engines[0] = &rcc_default_engine; + rcc_default_languages[pos].engines[epos] = NULL; - if (pos == lpos) rcc_default_languages[++lpos].sn = NULL; + if (pos == lpos) rcc_default_languages[++lpos].sn = NULL; + } } clear: -- cgit v1.2.3