]> code.citadel.org Git - citadel.git/blobdiff - webcit/gettext.c
Began moving date outputs to strftime_l()
[citadel.git] / webcit / gettext.c
index e84e3bab47e03a43dc7628060f198a186cc6ae59..c83c41ee07f5fc81b9b5ec563686cdb6e7968acf 100644 (file)
@@ -3,10 +3,9 @@
  */
 /**
  * \defgroup LocaleHeaderParser Parse the browser http locale headers and set the NLS stuff.
+ * \ingroup WebcitHttpServer 
  */
 /*@{*/
-/** we need _GNU_SOURCE for various functions arround the NLS-Stuff */
-#define _GNU_SOURCE
 #include "webcit.h"
 #include "webserver.h"
 
@@ -59,8 +58,6 @@ void httplang_to_locale(char *LocaleString)
        int nBest;
        int nParts;
        char *search = (char *) malloc(len);
-       // locale_t my_Locale;
-       // locale_t my_Empty_Locale;
        
        memcpy(search, LocaleString, len);
        search[len] = '\0';
@@ -146,7 +143,9 @@ void httplang_to_locale(char *LocaleString)
                nBest=0;
        WC->selected_language=nBest;
        lprintf(9, "language found: %s\n", AvailLang[WC->selected_language]);
-       //      set_selected_language(selected_locale);
+       if (search != NULL) {
+               free(search);
+       }
 }
 
 /* TODO: we skip the language weightening so far. */
@@ -253,10 +252,20 @@ void initialize_locales(void) {
 
        for (i = 0; i < NUM_LANGS; ++i) {
                sprintf(buf, "%s.UTF8", AvailLang[i]);
-               wc_locales[i] = newlocale(LC_MESSAGES_MASK /* |LC_TIME_MASK FIXME */ ,
+               wc_locales[i] = newlocale(
+                       (LC_MESSAGES_MASK|LC_TIME_MASK),
                        buf,
                        Empty_Locale
                );
+               if (wc_locales[i] == NULL) {
+                       lprintf(1, "Error configuring locale for %s: %s\n",
+                               buf,
+                               strerror(errno)
+                       );
+               }
+               else {
+                       lprintf(3, "Configured available locale: %s\n", buf);
+               }
        }
 }