From: Wilfried Göesgens Date: Sat, 3 Dec 2005 12:04:12 +0000 (+0000) Subject: * fixed langage detection to work with simple 'de' and no other stuff X-Git-Tag: v7.86~4405 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=0fade3510821f3f5f8275f7fa8ef2d68a6b6794a;p=citadel.git * fixed langage detection to work with simple 'de' and no other stuff --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 05e0b7bf2..5818e2657 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,5 +1,8 @@ $Id$ +Sat Dec 3 10:28:03 CET 2005 dothebart +* fixed langage detection to work with simple 'de' and no other stuff + Fri Dec 2 17:49:32 EST 2005 ajc * Re-enabled browser language detection. This will be debugged and finalized. diff --git a/webcit/gettext.c b/webcit/gettext.c index 29a3ea98e..0f857c390 100644 --- a/webcit/gettext.c +++ b/webcit/gettext.c @@ -25,18 +25,19 @@ void httplang_to_locale(const char *LocaleString) // char *webcitdir = WEBCITDIR; locale_t my_Locale; locale_t my_Empty_Locale; + + // len = strlen(LocaleString); memcpy(search, LocaleString, len); - search[len + 1] = '\0'; - len = strlen(search); + search[len] = '\0'; /* the web browser sends '-', we need '_' */ for (i = 0; i < len; i++) if (search[i] == '-') search[i] = '_'; i = 0; - while ((search[i] != '\0') && !done && (nFound < 10)) { - if ((search[i] == ',') || (search[i] == ';')) + while ( !done && (nFound < 10)) { + if ((search[i] == ',') || (search[i] == ';') || (search[i] == '\0')) { - if (search[i] == ';') + if ((search[i] == ';') || (search[i] == '\0')) done = 1; search[i] = '\0'; wanted_locales[nFound] = (char *) &search[j]; @@ -48,7 +49,7 @@ void httplang_to_locale(const char *LocaleString) } /* todo: weight */ - for (i = 0; i <= nFound; i++) { + if (nFound > 0) for (i = 0; i <= nFound; i++) { for (j = 0; j < nAvail; j++) { int ret = strncasecmp(wanted_locales[i], AvailLang[j],