$Id$
+Fri Dec 2 17:49:32 EST 2005 ajc
+* Re-enabled browser language detection. This will be debugged and finalized.
+
Fri Dec 2 11:01:30 EST 2005 ajc
* wclib.js: fixed a syntax error
}
+/*
+ * Offer available languages in the login box
+ */
+void offer_languages(void) {
+
+#ifdef ENABLE_NLS
+
+wprintf("FIXME");
+
+#else /* ENABLE_NLS */
+
+wprintf("US English");
+
+#endif /* ENABLE_NLS */
+
+}
+
+
/*
* Display the login screen
*/
svprintf("USERNAME_BOX", WCS_STRING, "%s", _("User name:"));
svprintf("PASSWORD_BOX", WCS_STRING, "%s", _("Password:"));
+ svprintf("LANGUAGE_BOX", WCS_STRING, "%s", _("Language:"));
svprintf("LOGIN_BUTTON", WCS_STRING, "%s", _("Login"));
svprintf("NEWUSER_BUTTON", WCS_STRING, "%s", _("New User"));
svprintf("EXIT_BUTTON", WCS_STRING, "%s", _("Exit"));
svprintf("hello", WCS_SERVCMD, "MESG hello");
svprintf("BOXTITLE", WCS_STRING, _("%s - powered by Citadel"),
serv_info.serv_humannode);
+ svcallback("DO_LANGUAGE_BOX", offer_languages);
do_template("login");
int got_cookie = 0;
int gzip_ok = 0;
struct wcsession *TheSession, *sptr;
- char httpauth_string[SIZ];
- char httpauth_user[SIZ];
- char httpauth_pass[SIZ];
+ char httpauth_string[1024];
+ char httpauth_user[1024];
+ char httpauth_pass[1024];
+ char accept_language[256];
char *ptr = NULL;
strcpy(httpauth_string, "");
if_modified_since = httpdate_to_timestamp(&buf[19]);
}
- /*if (!strncasecmp(buf, "Accept-Language: ", 17)) {
- httplang_to_locale(&buf[17]);
- }*/
+#ifdef ENABLE_NLS
+ if (!strncasecmp(buf, "Accept-Language: ", 17)) {
+ safestrncpy(accept_language, &buf[17], sizeof accept_language);
+ }
+#endif
/*
* Read in the request
TheSession->http_sock = sock;
TheSession->lastreq = time(NULL); /* log */
TheSession->gzip_ok = gzip_ok;
+#ifdef ENABLE_NLS
+ httplang_to_locale(accept_language); /* FIXME do more here */
+#endif /* ENABLE_NLS */
session_loop(req); /* do transaction */
pthread_mutex_unlock(&TheSession->SessionMutex); /* unbind */
#include "webcit.h"
#include "webserver.h"
-static const char* AvailLang[]=
- {
- "de_DE"
-
+#ifdef ENABLE_NLS
- };
+static const char *AvailLang[] = {
+ "de_DE"
+};
/* TODO: we skip the language weightening so far. */
/* Accept-Language: 'de-de,en-us;q=0.7,en;q=0.3' */
-void httplang_to_locale(const char* LocaleString)
+void httplang_to_locale(const char *LocaleString)
{
- char *locale="C";
+ char *locale = "C";
char *wanted_locales[10];
- int i=0;
- int j=0;
- size_t len=strlen(LocaleString);
- int nFound=0;
- int nAvail=1;
- char *search=(char*)malloc(len);
- int done=0;
- // char *mo;
- // char *webcitdir = WEBCITDIR;
+ int i = 0;
+ int j = 0;
+ size_t len = strlen(LocaleString);
+ int nFound = 0;
+ int nAvail = 1;
+ char *search = (char *) malloc(len);
+ int done = 0;
+ // char *mo;
+ // char *webcitdir = WEBCITDIR;
locale_t my_Locale;
locale_t my_Empty_Locale;
- memcpy(search,LocaleString,len);
- search[len+1]='\0';
- len=strlen(search);
+ memcpy(search, LocaleString, len);
+ search[len + 1] = '\0';
+ len = strlen(search);
/* the web browser sends '-', we need '_' */
- for (i=0;i<len; i++)
- if (search[i]=='-') search[i]='_';
- i=0;
- while ((search[i]!='\0')&&
- !done &&
- (nFound<10))
+ for (i = 0; i < len; i++)
+ if (search[i] == '-')
+ search[i] = '_';
+ i = 0;
+ while ((search[i] != '\0') && !done && (nFound < 10)) {
+ if ((search[i] == ',') || (search[i] == ';'))
{
- if ((search[i]==',')||(search[i]==';'))
-
- {
- if (search[i]==';') done=1;
- search[i]='\0';
- wanted_locales[nFound]=(char*)&search[j];
- j=i+1;
- nFound++;
- }
-
- i++;
+ if (search[i] == ';')
+ done = 1;
+ search[i] = '\0';
+ wanted_locales[nFound] = (char *) &search[j];
+ j = i + 1;
+ nFound++;
}
+
+ i++;
+ }
/* todo: weight */
- for (i=0; i<=nFound; i++)
- {
- for (j=0;j<nAvail; j++)
- {
- int ret=strncasecmp(wanted_locales[i],
- AvailLang[j],
- strlen(wanted_locales[i]));
- if (!ret)
- {
- locale=(char*)AvailLang[j]; //wanted_locales[i];
- i=nFound+1;
- j=nAvail+1;
- continue;
- }
+ for (i = 0; i <= nFound; i++) {
+ for (j = 0; j < nAvail; j++) {
+ int ret = strncasecmp(wanted_locales[i],
+ AvailLang[j],
+ strlen(wanted_locales[i]));
+ if (!ret) {
+ locale = (char *) AvailLang[j]; //wanted_locales[i];
+ i = nFound + 1;
+ j = nAvail + 1;
+ continue;
+ }
- }
}
-
- len=strlen(locale);
- memcpy(search,locale,len);
- memcpy(&search[len],".UTF8",5);
- search[len+5]='\0';
- my_Empty_Locale=newlocale(LC_ALL_MASK, NULL, NULL); /* create default locale */
- my_Locale=newlocale(LC_MESSAGES_MASK/*|LC_TIME_MASK TODO */,
- search,
- my_Empty_Locale);
+ }
+
+ len = strlen(locale);
+ memcpy(search, locale, len);
+ memcpy(&search[len], ".UTF8", 5);
+ search[len + 5] = '\0';
+ my_Empty_Locale = newlocale(LC_ALL_MASK, NULL, NULL); /* create default locale */
+ my_Locale = newlocale(LC_MESSAGES_MASK /*|LC_TIME_MASK FIXME */ ,
+ search, my_Empty_Locale);
uselocale(my_Locale);
- //freelocale(my_Locale);
- // freelocale(my_Empty_Locale);
+ // freelocale(my_Locale);
+ // freelocale(my_Empty_Locale);
free(search);
-
}
+#endif
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-12-01 00:24-0500\n"
+"POT-Creation-Date: 2005-12-02 17:03-0500\n"
"PO-Revision-Date: 2005-11-13 15:22+100\n"
"Last-Translator: Wilfried Goesgens <w.goesgens@chaosindustries.de>\n"
"Language-Team: German <LL@li.org>\n"
msgid "Deleted"
msgstr "Löschen"
-#: ../auth.c:14 ../auth.c:58
+#: ../auth.c:14 ../auth.c:77
msgid "New User"
msgstr "Neuer Benutzer"
msgid "Aide"
msgstr "Mittelinitial"
-#: ../auth.c:39
+#: ../auth.c:57
#, c-format
msgid ""
"<ul><li><b>If you already have an account on %s</b>, enter your user name "
"fallen</li>\n"
"<br /></ul>"
-#: ../auth.c:55 ../who.c:258
+#: ../auth.c:73 ../who.c:258
msgid "User name:"
msgstr "Benutzername:"
-#: ../auth.c:56
+#: ../auth.c:74
#, fuzzy
msgid "Password:"
msgstr "Passwort"
-#: ../auth.c:57
+#: ../auth.c:75
+msgid "Language:"
+msgstr ""
+
+#: ../auth.c:76
msgid "Login"
msgstr "Anmelden"
-#: ../auth.c:59 ../paging.c:474
+#: ../auth.c:78 ../paging.c:474
msgid "Exit"
msgstr "Ende"
-#: ../auth.c:61
+#: ../auth.c:80
#, c-format
msgid "%s - powered by Citadel"
msgstr "%s - mit Citadel-Technologie"
-#: ../auth.c:132 ../auth.c:470
+#: ../auth.c:157 ../auth.c:503
msgid "Blank passwords are not allowed."
msgstr "Leere Passwörter sind nicht zulässig."
-#: ../auth.c:153
+#: ../auth.c:178
msgid "Your password was not accepted."
msgstr "Ihr Passwort wurde nicht akzeptiert"
-#: ../auth.c:245
+#: ../auth.c:278
msgid ""
"This program was unable to connect or stay connected to the Citadel server. "
"Please report this problem to your system administrator."
"Dieses Programm konnte keine Verbindung zum Citadel-Server herstellen oder "
"aufrechterhalten.Bitte wenden Sie sich an Ihren Administrator."
-#: ../auth.c:253
+#: ../auth.c:286
msgid "Close window"
msgstr "Fenster Schließen"
-#: ../auth.c:274 ../mainmenu.c:239
+#: ../auth.c:307 ../mainmenu.c:239
msgid "Validate new users"
msgstr "Neue Benutzer überprüfen"
-#: ../auth.c:325
+#: ../auth.c:358
#, c-format
msgid "Current access level: %d (%s)\n"
msgstr "Aktuelle Berechtigungen: %d (%s)\n"
-#: ../auth.c:333
+#: ../auth.c:366
msgid "Select access level for this user:"
msgstr "Berechtigungen dieses Benutzers"
-#: ../auth.c:395 ../mainmenu.c:135
+#: ../auth.c:428 ../mainmenu.c:135
msgid "Change your password"
msgstr "Ändern Sie Ihr Passwort"
-#: ../auth.c:424
+#: ../auth.c:457
msgid "Enter new password:"
msgstr "Bitte geben Sie ein neues Passwort ein"
-#: ../auth.c:428
+#: ../auth.c:461
msgid "Enter it again to confirm:"
msgstr "Nocheinmal zur Verifizierung:"
-#: ../auth.c:433
+#: ../auth.c:466
msgid "Change password"
msgstr "Passwort ändern"
-#: ../auth.c:435 ../calendar.c:582 ../event.c:385 ../graphics.c:57
+#: ../auth.c:468 ../calendar.c:582 ../event.c:385 ../graphics.c:57
#: ../iconbar.c:699 ../mainmenu.c:298 ../messages.c:2590 ../messages.c:2693
#: ../messages.c:2777 ../netconf.c:79 ../netconf.c:139 ../paging.c:56
#: ../preferences.c:361 ../roomops.c:1162 ../roomops.c:1489 ../roomops.c:1917
msgid "Cancel"
msgstr "Abbruch"
-#: ../auth.c:451
+#: ../auth.c:484
msgid "Cancelled. Password was not changed."
msgstr "Abgebrochen. Passwort wurde nicht gesetzt."
-#: ../auth.c:462
+#: ../auth.c:495
msgid "They don't match. Password was not changed."
msgstr "Die Passwörter stimmen nicht überein. Passwort nicht geändert"
msgid "realloc() error! couldn't get %d bytes: %s"
msgstr "realloc() Fehler! Konnte %d Bytes nicht alloziieren: %s"
-#: ../iconbar.c:97 ../iconbar.c:391
+#: ../iconbar.c:97 ../iconbar.c:381
msgid "Find out more about Citadel"
msgstr "Mehr über Citadel herausfinden"
-#: ../iconbar.c:98 ../iconbar.c:392
+#: ../iconbar.c:98 ../iconbar.c:382
msgid "CITADEL"
msgstr "CITADEL"
msgid "Administration"
msgstr "Verwaltung"
-#: ../iconbar.c:300 ../iconbar.c:309 ../mainmenu.c:108
+#: ../iconbar.c:299 ../iconbar.c:308 ../iconbar.c:392 ../iconbar.c:401
+#: ../mainmenu.c:108
msgid "Log off"
msgstr "Abmelden"
-#: ../iconbar.c:301
+#: ../iconbar.c:300 ../iconbar.c:393
msgid "Log off now?"
msgstr "Jetzt abmelden?"
-#: ../iconbar.c:320
+#: ../iconbar.c:318
msgid "Customize this menu"
msgstr "Dieses Menü bearbeiten"
-#: ../iconbar.c:321
+#: ../iconbar.c:319
msgid "customize this menu"
msgstr "Dieses Menü Bearbeiten"
-#: ../iconbar.c:396
+#: ../iconbar.c:386
#, fuzzy
msgid "switch to menu"
msgstr "Zurück zum Menü"
msgid "Expire by message count"
msgstr "Nachrichten nach Anzahl löschen"
-#: ../roomops.c:1541 ../roomops.c:2843
+#: ../roomops.c:1541 ../roomops.c:2880
msgid "Cancelled. Changes were not saved."
msgstr "Abgebrochen. Änderungen wurden nicht übernommen."
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-12-01 00:24-0500\n"
+"POT-Creation-Date: 2005-12-02 17:03-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "Deleted"
msgstr ""
-#: ../auth.c:14 ../auth.c:58
+#: ../auth.c:14 ../auth.c:77
msgid "New User"
msgstr ""
msgid "Aide"
msgstr ""
-#: ../auth.c:39
+#: ../auth.c:57
#, c-format
msgid ""
"<ul><li><b>If you already have an account on %s</b>, enter your user name "
"receive any instant messages.<br /></ul>"
msgstr ""
-#: ../auth.c:55 ../who.c:258
+#: ../auth.c:73 ../who.c:258
msgid "User name:"
msgstr ""
-#: ../auth.c:56
+#: ../auth.c:74
msgid "Password:"
msgstr ""
-#: ../auth.c:57
+#: ../auth.c:75
+msgid "Language:"
+msgstr ""
+
+#: ../auth.c:76
msgid "Login"
msgstr ""
-#: ../auth.c:59 ../paging.c:474
+#: ../auth.c:78 ../paging.c:474
msgid "Exit"
msgstr ""
-#: ../auth.c:61
+#: ../auth.c:80
#, c-format
msgid "%s - powered by Citadel"
msgstr ""
-#: ../auth.c:132 ../auth.c:470
+#: ../auth.c:157 ../auth.c:503
msgid "Blank passwords are not allowed."
msgstr ""
-#: ../auth.c:153
+#: ../auth.c:178
msgid "Your password was not accepted."
msgstr ""
-#: ../auth.c:245
+#: ../auth.c:278
msgid ""
"This program was unable to connect or stay connected to the Citadel server. "
"Please report this problem to your system administrator."
msgstr ""
-#: ../auth.c:253
+#: ../auth.c:286
msgid "Close window"
msgstr ""
-#: ../auth.c:274 ../mainmenu.c:239
+#: ../auth.c:307 ../mainmenu.c:239
msgid "Validate new users"
msgstr ""
-#: ../auth.c:325
+#: ../auth.c:358
#, c-format
msgid "Current access level: %d (%s)\n"
msgstr ""
-#: ../auth.c:333
+#: ../auth.c:366
msgid "Select access level for this user:"
msgstr ""
-#: ../auth.c:395 ../mainmenu.c:135
+#: ../auth.c:428 ../mainmenu.c:135
msgid "Change your password"
msgstr ""
-#: ../auth.c:424
+#: ../auth.c:457
msgid "Enter new password:"
msgstr ""
-#: ../auth.c:428
+#: ../auth.c:461
msgid "Enter it again to confirm:"
msgstr ""
-#: ../auth.c:433
+#: ../auth.c:466
msgid "Change password"
msgstr ""
-#: ../auth.c:435 ../calendar.c:582 ../event.c:385 ../graphics.c:57
+#: ../auth.c:468 ../calendar.c:582 ../event.c:385 ../graphics.c:57
#: ../iconbar.c:699 ../mainmenu.c:298 ../messages.c:2590 ../messages.c:2693
#: ../messages.c:2777 ../netconf.c:79 ../netconf.c:139 ../paging.c:56
#: ../preferences.c:361 ../roomops.c:1162 ../roomops.c:1489 ../roomops.c:1917
msgid "Cancel"
msgstr ""
-#: ../auth.c:451
+#: ../auth.c:484
msgid "Cancelled. Password was not changed."
msgstr ""
-#: ../auth.c:462
+#: ../auth.c:495
msgid "They don't match. Password was not changed."
msgstr ""
msgid "realloc() error! couldn't get %d bytes: %s"
msgstr ""
-#: ../iconbar.c:97 ../iconbar.c:391
+#: ../iconbar.c:97 ../iconbar.c:381
msgid "Find out more about Citadel"
msgstr ""
-#: ../iconbar.c:98 ../iconbar.c:392
+#: ../iconbar.c:98 ../iconbar.c:382
msgid "CITADEL"
msgstr ""
msgid "Administration"
msgstr ""
-#: ../iconbar.c:300 ../iconbar.c:309 ../mainmenu.c:108
+#: ../iconbar.c:299 ../iconbar.c:308 ../iconbar.c:392 ../iconbar.c:401
+#: ../mainmenu.c:108
msgid "Log off"
msgstr ""
-#: ../iconbar.c:301
+#: ../iconbar.c:300 ../iconbar.c:393
msgid "Log off now?"
msgstr ""
-#: ../iconbar.c:320
+#: ../iconbar.c:318
msgid "Customize this menu"
msgstr ""
-#: ../iconbar.c:321
+#: ../iconbar.c:319
msgid "customize this menu"
msgstr ""
-#: ../iconbar.c:396
+#: ../iconbar.c:386
msgid "switch to menu"
msgstr ""
msgid "Expire by message count"
msgstr ""
-#: ../roomops.c:1541 ../roomops.c:2843
+#: ../roomops.c:1541 ../roomops.c:2880
msgid "Cancelled. Changes were not saved."
msgstr ""
<td><input type="text" name="name" maxlength="25"></td></tr>
<tr><td><?PASSWORD_BOX></td>
<td><input type="password" name="pass" maxlength="20"></td></tr>
+ <tr><td><?LANGUAGE_BOX></td>
+ <td><?DO_LANGUAGE_BOX></td></tr>
<tr><td align=center colspan=2>
<input type="submit" name="login_action" value="<?LOGIN_BUTTON>">