From: Art Cancro Date: Fri, 2 Dec 2005 22:50:30 +0000 (+0000) Subject: * Re-enabled browser language detection. This will be debugged and finalized. X-Git-Tag: v7.86~4406 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=78f9d4f403235ef4e9e30ce2c65d485c9f7299f6;p=citadel.git * Re-enabled browser language detection. This will be debugged and finalized. --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 231b1ce68..05e0b7bf2 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,5 +1,8 @@ $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 diff --git a/webcit/auth.c b/webcit/auth.c index 6ba3d95e4..7b1733b3b 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -20,6 +20,24 @@ void initialize_axdefs(void) { } +/* + * 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 */ @@ -54,12 +72,14 @@ void display_login(char *mesg) 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"); diff --git a/webcit/context_loop.c b/webcit/context_loop.c index 1223ae5f2..1667fdc19 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -246,9 +246,10 @@ void context_loop(int sock) 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, ""); @@ -293,9 +294,11 @@ void context_loop(int sock) 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 @@ -431,6 +434,9 @@ void context_loop(int sock) 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 */ diff --git a/webcit/gettext.c b/webcit/gettext.c index f5e5a331b..29a3ea98e 100644 --- a/webcit/gettext.c +++ b/webcit/gettext.c @@ -2,86 +2,79 @@ #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\n" "Language-Team: German \n" @@ -21,7 +21,7 @@ msgstr "" msgid "Deleted" msgstr "Löschen" -#: ../auth.c:14 ../auth.c:58 +#: ../auth.c:14 ../auth.c:77 msgid "New User" msgstr "Neuer Benutzer" @@ -49,7 +49,7 @@ msgstr "nur Privilegierte Benutzer" msgid "Aide" msgstr "Mittelinitial" -#: ../auth.c:39 +#: ../auth.c:57 #, c-format msgid "" "
  • If you already have an account on %s, enter your user name " @@ -71,37 +71,41 @@ msgstr "" "fallen
  • \n" "
" -#: ../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." @@ -109,40 +113,40 @@ msgstr "" "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 @@ -151,11 +155,11 @@ msgstr "Passwort ändern" 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" @@ -581,11 +585,11 @@ msgstr "Sie haben keine Datei hochgeladen." 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" @@ -671,23 +675,24 @@ msgstr "Räume und Verwaltung" 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ü" @@ -1811,7 +1816,7 @@ msgstr "Die Systemvorgabe benutzen" 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." diff --git a/webcit/po/webcit.pot b/webcit/po/webcit.pot index 1ba69c386..4a9ab7461 100644 --- a/webcit/po/webcit.pot +++ b/webcit/po/webcit.pot @@ -8,7 +8,7 @@ msgid "" 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 \n" "Language-Team: LANGUAGE \n" @@ -20,7 +20,7 @@ msgstr "" msgid "Deleted" msgstr "" -#: ../auth.c:14 ../auth.c:58 +#: ../auth.c:14 ../auth.c:77 msgid "New User" msgstr "" @@ -44,7 +44,7 @@ msgstr "" msgid "Aide" msgstr "" -#: ../auth.c:39 +#: ../auth.c:57 #, c-format msgid "" "
  • If you already have an account on %s, enter your user name " @@ -56,75 +56,79 @@ msgid "" "receive any instant messages.
" 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 @@ -133,11 +137,11 @@ msgstr "" 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 "" @@ -542,11 +546,11 @@ 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 "" @@ -630,23 +634,24 @@ 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 "" @@ -1738,7 +1743,7 @@ 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 "" diff --git a/webcit/static/login.html b/webcit/static/login.html index cd1ee061d..c2692c817 100644 --- a/webcit/static/login.html +++ b/webcit/static/login.html @@ -12,6 +12,8 @@ + +