Index: search/namazu-cgi.sh =================================================================== --- search/namazu-cgi.sh (revision 19177) +++ search/namazu-cgi.sh (working copy) @@ -3,15 +3,19 @@ # Namazu CGI wrapper. Deal with LANG # -# compute the langinfo from the PATH_INFO -langinfo=`echo $PATH_INFO | grep '^/\w*' | sed -e 's#^/\(\w*\).*$#\1#'` +# compute the langinfo from the $QUERY_STRING +langinfo=`echo "$QUERY_STRING" | grep -oE '(^|[?&])lang=([a-zA-Z_]+)' | cut -f 2 -d "="` +if [ -z "$langinfo" ]; then + # if cannot get langinfo from $QUERY_STRING, then get it from COOKIE + langinfo=`echo "$HTTP_COOKIE" | grep -oE '(^|[?&])lang_cookie=([a-zA-Z_]+)' | cut -f 2 -d "="` +fi if [ -n "$langinfo" ] ; then LANG="$langinfo" - SCRIPT_NAME="$SCRIPT_NAME/$langinfo" export LANG + echo "Set-Cookie: lang_cookie=$langinfo" fi -#SCRIPT_NAME="$SCRIPT_NAME/" + export SCRIPT_NAME exec /var/www/cgi-bin/namazu.cgi Index: search/search.phtml =================================================================== --- search/search.phtml (revision 0) +++ search/search.phtml (revision 0) @@ -0,0 +1,14 @@ + $value){ putenv("$key=$value"); } +# Set 'LANG' env +putenv("LANG=$locale"); +# Run namazu.cgi +ob_start(); +system("/usr/lib/cgi-bin/namazu.cgi"); +$out = ob_get_contents(); +ob_end_clean(); +# remove HTTP Header from namazu.cgi output. +echo preg_replace("/^Content-type:.*/", "", $out); +?> Index: lang.php =================================================================== --- lang.php (revision 19177) +++ lang.php (working copy) @@ -65,5 +65,7 @@ T_bind_textdomain_codeset($domain, 'UTF-8'); T_textdomain($domain); + +$lang_cookie = $_COOKIE['lang_cookie']; echo ("\n"); ?> Index: Makefile =================================================================== --- Makefile (revision 19177) +++ Makefile (working copy) @@ -40,8 +40,7 @@ # add when we have utf-8 translations: iconv -f UTF-8 -t ISO8859-1 nmz.onefile: - ( echo '$$text_dir = "."; ?>'; \ - cat $(TMPLBASE)$(FILE).php_tmpl ) | php -q > \ + ( cat $(TMPLBASE)$(FILE).php_tmpl ) | php -q > \ $(TMPLBASE)$(FILE)$(FILETAIL) nmz.lang: