X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fgettext.c;h=095395970225ad760835beb9e3661d9bdc92deac;hb=8637e272fdb07a5b7f6d95dce8e27fce2daa6c76;hp=71ede4e0ad2083f58f66a6ae57307d78f6f34758;hpb=898bab06ba7d6cf04a9b5e41bfcc6319ff3bb8de;p=citadel.git
diff --git a/webcit/gettext.c b/webcit/gettext.c
index 71ede4e0a..095395970 100644
--- a/webcit/gettext.c
+++ b/webcit/gettext.c
@@ -14,7 +14,7 @@
#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",
@@ -40,16 +40,19 @@ const char *AvailLang[] = {
"ro_RO",
"sl_SL",
"tr_TR",
+ "ar_AR",
""
};
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("