* finish setting the wanted locale.
authorWilfried Goesgens <dothebart@citadel.org>
Mon, 27 Sep 2010 21:03:29 +0000 (23:03 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Mon, 27 Sep 2010 21:36:23 +0000 (23:36 +0200)
citadel/utils/setup.c

index cbe30e96b4b04d41c77ea3b493d75b60558081b4..18e695329f441324b974c6bcaa89da6e77ce0ae4 100644 (file)
@@ -102,12 +102,20 @@ const char *setup_text[eMaxQuestions];
 
 void SetTitles(void)
 {
+       char *locale;
        int have_run_dir;
 #ifndef HAVE_RUN_DIR
        have_run_dir = 1;
 #else
        have_run_dir = 0;
 #endif
+
+       locale = setlocale(LC_MESSAGES, getenv("LANG"));
+
+       bindtextdomain("citadel-setup", LOCALEDIR"/locale");
+       textdomain("citadel-setup");
+       bind_textdomain_codeset("citadel-setup","UTF8");
+
        setup_titles[eCitadelHomeDir] = _("Citadel Home Directory");
        if (have_run_dir)
                setup_text[eCitadelHomeDir] = _(
@@ -214,6 +222,19 @@ void SetTitles(void)
 "If you entered a Bind DN in the previous question, you must now enter\n"
 "the password associated with that account.  Otherwise, you can leave this\n"
 "blank.\n");
+
+#if 0
+// Debug loading of locales... Strace does a better job though.
+       printf("Message catalog directory: %s\n", bindtextdomain("citadel-setup", LOCALEDIR"/locale"));
+       printf("Text domain: %s\n", textdomain("citadel-setup"));
+       printf("Text domain Charset: %s\n", bind_textdomain_codeset("citadel-setup","UTF8"));
+       {
+               int i;
+               for (i = 0; i < eMaxQuestions; i++)
+                       printf("%s - %s\n", setup_titles[i], _(setup_titles[i]));
+               exit(0);
+       }
+#endif
 }
 
 /*