From: Wilfried Göesgens Date: Tue, 5 Aug 2008 19:22:10 +0000 (+0000) Subject: * remove locales from the login window if webcit isn't able to load it. X-Git-Tag: v7.86~2047 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=0cb097cb436138481a62845f45118ee7979ae75d * remove locales from the login window if webcit isn't able to load it. --- diff --git a/webcit/gettext.c b/webcit/gettext.c index 52332f815..549dfa0d8 100644 --- a/webcit/gettext.c +++ b/webcit/gettext.c @@ -11,7 +11,7 @@ #define SEARCH_LANG 20 /* how many langs should we parse? */ /* actual supported locales */ -char *AvailLang[NUM_LANGS] = { +const char *AvailLang[NUM_LANGS] = { "C", "en_US", "de_DE", @@ -24,6 +24,9 @@ char *AvailLang[NUM_LANGS] = { "pt_BR" }; +const char *AvailLangLoaded[NUM_LANGS]; +long nLocalesLoaded = 0; + #ifdef HAVE_USELOCALE locale_t wc_locales[NUM_LANGS]; /**< here we keep the parsed stuff */ #endif @@ -109,19 +112,19 @@ void httplang_to_locale(char *LocaleString) /** check if we have this lang */ ls->availability=1; ls->selectedlang=-1; - for (j=0; jlang[0], AvailLang[j]); + result=strcasecmp(&ls->lang[0], AvailLangLoaded[j]); if ((result<0)&&(resultavailability)){ ls->availability=result; ls->selectedlang=j; } /** match against lang and locale */ - if (0==strcasecmp(&lbuf[0], AvailLang[j])){ + if (0==strcasecmp(&lbuf[0], AvailLangLoaded[j])){ ls->availability=0; ls->selectedlang=j; - j=NUM_LANGS; + j=nLocalesLoaded; } } } @@ -145,7 +148,7 @@ void httplang_to_locale(char *LocaleString) nBest=0; } WC->selected_language=nBest; - lprintf(9, "language found: %s\n", AvailLang[WC->selected_language]); + lprintf(9, "language found: %s\n", AvailLangLoaded[WC->selected_language]); } /* TODO: we skip the language weighting so far. */ @@ -202,14 +205,14 @@ void offer_languages(void) { wprintf("