GETTEXT: represent C as en_US to the user - no one speaks C that fluently after all ;-)
[citadel.git] / webcit / gettext.c
index e1424b7a0c10b78ce112fda0eeee7b5c35d02be9..acb0331ce74ae6bbe19eb5fc9a8b38f306a4ad5d 100644 (file)
@@ -17,8 +17,8 @@
 #ifdef ENABLE_NLS
 /* actual supported locales */
 const char *AvailLang[] = {
-       "C",
-       "ar_AR",
+       "en_US",
+       "ar_AE",
        "bg_BG",
        "cs_CZ",
        "en_US",
@@ -41,7 +41,6 @@ const char *AvailLang[] = {
        "ro_RO",
        "sl_SL",
        "tr_TR",
-       "ar_AR",
        ""
 };
 
@@ -318,7 +317,8 @@ void initialize_locales(void) {
                if ((language != NULL) && (strcmp(AvailLang[i], language) != 0))
                        continue;
                if (i == 0) {
-                       sprintf(buf, "%s", AvailLang[i]);       /* locale 0 (C) is ascii, not utf-8 */
+                       sprintf(buf, "C");      /* locale 0 (C) is ascii, not utf-8 */
+                       
                }
                else {
                        sprintf(buf, "%s.UTF8", AvailLang[i]);
@@ -333,7 +333,7 @@ void initialize_locales(void) {
                        syslog(LOG_NOTICE, "locale for %s disabled: %s", buf, strerror(errno));
                }
                else {
-                       syslog(LOG_INFO, "Found locale: %s", buf);
+                       syslog(LOG_INFO, "Found locale: %s - %s", buf, AvailLang[i]);
                        AvailLangLoaded[nLocalesLoaded] = AvailLang[i];
                        nLocalesLoaded++;
                }
@@ -428,10 +428,11 @@ void initialize_locales(void) {
 
 #endif /* ENABLE_NLS */
 
-
 void TmplGettext(StrBuf *Target, WCTemplputParams *TP)
 {
-       StrBufAppendBufPlain(Target, _(TP->Tokens->Params[0]->Start), -1, 0);
+       const char *Text = _(TP->Tokens->Params[0]->Start);
+
+       StrBufAppendTemplateStr(Target, TP, Text, 1);
 }
 
 
@@ -442,7 +443,7 @@ void TmplGettext(StrBuf *Target, WCTemplputParams *TP)
 const char *get_selected_language(void) {
 #ifdef ENABLE_NLS
 #ifdef HAVE_USELOCALE
-       return AvailLang[WC->selected_language];
+       return AvailLangLoaded[WC->selected_language];
 #else
        return "en";
 #endif