GETTEXT: when re-using a session, make shure we re-detect the locales.
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 25 Jun 2013 21:13:40 +0000 (23:13 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 25 Jun 2013 21:13:40 +0000 (23:13 +0200)
webcit/context_loop.c
webcit/gettext.c

index 5320e56..ee30aaa 100644 (file)
@@ -633,9 +633,9 @@ void context_loop(ParsedHttpHdrs *Hdr)
         * table from getting bombarded with new sessions when, for example, a web
         * spider crawls the site without using cookies.
         */
-       if ((session_may_be_reused) && (!WC->logged_in)) {
-               WC->wc_session = 0;                     /* flag as available for re-use */
-               TheSession->selected_language = 0;      /* clear any non-default language setting */
+       if ((session_may_be_reused) && (!TheSession->logged_in)) {
+               TheSession->wc_session = 0;             /* flag as available for re-use */
+               TheSession->selected_language = -1;     /* clear any non-default language setting */
        }
 
        TheSession->Hdr = NULL;
index 83b2df4..0ac19d0 100644 (file)
@@ -262,7 +262,12 @@ void set_selected_language(const char *lang) {
 void go_selected_language(void) {
 #ifdef HAVE_USELOCALE
        wcsession *WCC = WC;
-       if (WCC->selected_language < 0) return;
+       if (WCC->selected_language < 0)
+       {
+               httplang_to_locale(WCC->Hdr->HR.browser_language, WCC);
+               if (WCC->selected_language < 0)
+                       return;
+       }
        uselocale(wc_locales[WCC->selected_language]);  /* switch locales */
        textdomain(textdomain(NULL));                   /* clear the cache */
 #else