Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
[citadel.git] / webcit / gettext.c
index 58a0edd8d78bb48437893ecab62f4a47ccf37ab4..5e5d0909bb2e1bc55d37e4b71e656adbd8b7c2a4 100644 (file)
@@ -51,7 +51,7 @@ locale_t *wc_locales; /* here we keep the parsed stuff */
 #endif
 
 /* Keep information about one locale */
-typedef struct _lang_pref{
+typedef struct _lang_pref {
        char lang[16];          /* the language locale string */
        char region[16];        /* the region locale string */
        long priority;          /* which priority does it have */
@@ -293,13 +293,6 @@ void initialize_locales(void) {
        char buf[32];
        char *language = NULL;
 
-#ifdef ENABLE_NLS
-       setlocale(LC_ALL, "");
-       syslog(9, "Text domain: %s", textdomain("webcit"));
-       syslog(9, "Message catalog directory: %s", bindtextdomain(textdomain(NULL), LOCALEDIR"/locale"));
-       syslog(9, "Text domain Charset: %s", bind_textdomain_codeset("webcit","UTF8"));
-#endif
-
        nLocales = 0; 
        while (!IsEmptyStr(AvailLang[nLocales]))
                nLocales++;
@@ -332,15 +325,10 @@ void initialize_locales(void) {
                wc_locales[nLocalesLoaded] = newlocale(
                        (LC_MESSAGES_MASK|LC_TIME_MASK),
                        buf,
-                       Empty_Locale
+                       (((i > 0) && (wc_locales[0] != NULL)) ? wc_locales[0] : Empty_Locale)
                );
                if (wc_locales[nLocalesLoaded] == NULL) {
-                       syslog(1, "locale for %s disabled: %s (domain: %s, path: %s)",
-                               buf,
-                               strerror(errno),
-                               textdomain(NULL),
-                               bindtextdomain(textdomain(NULL), NULL)
-                       );
+                       syslog(1, "locale for %s disabled: %s", buf, strerror(errno));
                }
                else {
                        syslog(3, "Found locale: %s", buf);
@@ -376,6 +364,13 @@ void initialize_locales(void) {
                AvailLangLoaded[0] = AvailLang[0];
                nLocalesLoaded = 1;
        }
+
+#ifdef ENABLE_NLS
+       setlocale(LC_ALL, "");
+       syslog(9, "Text domain: %s", textdomain("webcit"));
+       syslog(9, "Text domain Charset: %s", bind_textdomain_codeset("webcit", "UTF8"));
+       syslog(9, "Message catalog directory: %s", bindtextdomain(textdomain(NULL), LOCALEDIR"/locale"));
+#endif
 }
 
 
@@ -402,6 +397,13 @@ const char *AvailLang[] = {
 };
 
 /* dummy for non NLS enabled systems */
+void 
+ServerShutdownModule_GETTEXT
+(void)
+{
+}
+
+
 void tmplput_offer_languages(StrBuf *Target, WCTemplputParams *TP)
 {
        wc_printf("English (US)");