Simplified tmplput_offer_languages() behavior on non-locale systems
authorArt Cancro <ajc@uncensored.citadel.org>
Tue, 21 Feb 2012 23:44:40 +0000 (18:44 -0500)
committerArt Cancro <ajc@uncensored.citadel.org>
Tue, 21 Feb 2012 23:44:40 +0000 (18:44 -0500)
webcit/gettext.c

index 25474e810c5b8f68eb2f521cdc90de0be6dbb3ad..4df641a28e7ce01f4eb1a8fda82878ae59140fa1 100644 (file)
@@ -209,25 +209,12 @@ void httplang_to_locale(StrBuf *LocaleString, wcsession *sess)
  */
 void tmplput_offer_languages(StrBuf *Target, WCTemplputParams *TP)
 {
+#ifdef HAVE_USELOCALE
        int i;
-#ifndef HAVE_USELOCALE
-       char *Lang = getenv("LANG");
-       
-       if (Lang == NULL)
-               Lang = "C";
-#endif
-
-       if (nLocalesLoaded == 1) {
-               wc_printf("<p>%s</p>", AvailLangLoaded[0]);
-               return;
-       }
 
        wc_printf("<select name=\"language\" id=\"lname\" size=\"1\" onChange=\"switch_to_lang($('lname').value);\">\n");
 
        for (i=0; i < nLocalesLoaded; ++i) {
-#ifndef HAVE_USELOCALE
-               if (strcmp(AvailLangLoaded[i], Lang) == 0)
-#endif
                wc_printf("<option %s value=%s>%s</option>\n",
                        ((WC->selected_language == i) ? "selected" : ""),
                        AvailLangLoaded[i],
@@ -236,6 +223,9 @@ void tmplput_offer_languages(StrBuf *Target, WCTemplputParams *TP)
        }
 
        wc_printf("</select>\n");
+#else
+       wc_printf("%s", (getenv("LANG") ? getenv("LANG") : "C"));
+#endif
 }
 
 /*