X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Fgettext.c;h=54d4ba3ae5cb0f7e5eca6448c28ad98b6c3acad4;hp=71ede4e0ad2083f58f66a6ae57307d78f6f34758;hb=a6e90dc4d19b9d7b7f9b55d281cf237bc5f40f66;hpb=898bab06ba7d6cf04a9b5e41bfcc6319ff3bb8de
diff --git a/webcit/gettext.c b/webcit/gettext.c
index 71ede4e0a..54d4ba3ae 100644
--- a/webcit/gettext.c
+++ b/webcit/gettext.c
@@ -14,10 +14,11 @@
#include "webserver.h"
#define SEARCH_LANG 20 /* how many langs should we parse? */
-#ifdef HAVE_USELOCALE
+#ifdef ENABLE_NLS
/* actual supported locales */
const char *AvailLang[] = {
"C",
+ "ar_AR",
"bg_BG",
"cs_CZ",
"en_US",
@@ -46,10 +47,12 @@ const char *AvailLang[] = {
const char **AvailLangLoaded;
long nLocalesLoaded = 0;
+#ifdef HAVE_USELOCALE
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 */
@@ -194,7 +197,7 @@ void httplang_to_locale(StrBuf *LocaleString, wcsession *sess)
nBest=0;
}
sess->selected_language = nBest;
- syslog(9, "language found: %s", AvailLangLoaded[WC->selected_language]);
+ syslog(LOG_DEBUG, "language found: %s", AvailLangLoaded[WC->selected_language]);
FreeStrBuf(&Buf);
FreeStrBuf(&SBuf);
}
@@ -208,10 +211,24 @@ void httplang_to_locale(StrBuf *LocaleString, wcsession *sess)
void tmplput_offer_languages(StrBuf *Target, WCTemplputParams *TP)
{
int i;
+#ifndef HAVE_USELOCALE
+ char *Lang = getenv("LANG");
+
+ if (Lang == NULL)
+ Lang = "C";
+#endif
+
+ if (nLocalesLoaded == 1) {
+ wc_printf("
%s
", AvailLangLoaded[0]);
+ return;
+ }
wc_printf("