summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rcclocale.c11
-rw-r--r--src/rccstring.c2
-rw-r--r--src/rccxml.c22
3 files changed, 20 insertions, 15 deletions
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: