Sophie

Sophie

distrib > * > cooker > x86_64 > by-pkgid > 059f7a4aaf6fd1abf9c488af664ae035 > files > 353

mnogosearch-3.3.10-5.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Search pages with multi-lingual interface
    
  </TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="mnoGoSearch 3.3.10 reference manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Multiple languages support"
HREF="msearch-international.html"><LINK
REL="PREVIOUS"
TITLE="Multiple languages support"
HREF="msearch-international.html"><LINK
REL="NEXT"
TITLE="
   Segmenters for Chinese, Thai and Japanese languages
  "
HREF="msearch-cjk.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="mnogo.css"><META
NAME="Description"
CONTENT="mnoGoSearch - Full Featured Web site Open Source Search Engine Software over the Internet and Intranet Web Sites Based on SQL Database. It is a Free search software covered by GNU license."><META
NAME="Keywords"
CONTENT="shareware, freeware, download, internet, unix, utilities, search engine, text retrieval, knowledge retrieval, text search, information retrieval, database search, mining, intranet, webserver, index, spider, filesearch, meta, free, open source, full-text, udmsearch, website, find, opensource, search, searching, software, udmsearch, engine, indexing, system, web, ftp, http, cgi, php, SQL, MySQL, database, php3, FreeBSD, Linux, Unix, mnoGoSearch, MacOS X, Mac OS X, Windows, 2000, NT, 95, 98, GNU, GPL, url, grabbing"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#EEEEEE"
TEXT="#000000"
LINK="#000080"
VLINK="#800080"
ALINK="#FF0000"
><!--#include virtual="body-before.html"--><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
><SPAN
CLASS="application"
>mnoGoSearch</SPAN
> 3.3.10 reference manual: Full-featured search engine software</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="msearch-international.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 9. Multiple languages support</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="msearch-cjk.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="multilang"
>Search pages with multi-lingual interface
    <A
NAME="AEN4150"
></A
></A
></H1
><P
>The original instructions in this article
  were made by Craig Small
  <CODE
CLASS="email"
>&#60;<A
HREF="mailto:csmall[at]eye-net[dot]com[dot].au"
>csmall[at]eye-net[dot]com[dot].au</A
>&#62;</CODE
>.
  Some later changes were done by Alexander Barkov 
  <CODE
CLASS="email"
>&#60;<A
HREF="mailto:bar@mnogosearch.org"
>bar@mnogosearch.org</A
>&#62;</CODE
>.
  </P
><P
>&#13;  In case of a multi-lingual search engine
  it is convenient to display search form
  and search results using the language
  according to the user browser preferences.
  This article describes how to configure
  a multi-lingual interface for the
  <SPAN
CLASS="application"
>mnoGoSearch</SPAN
> +
  <SPAN
CLASS="application"
>Apache</SPAN
> combination.
  </P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="multilang-install"
>Installing a multi-lingual interface</A
></H2
><P
>&#13;  The general idea of this method uses the fact that <SPAN
CLASS="application"
>search.cgi</SPAN
>
  opens a template having the same name with the <ACRONYM
CLASS="acronym"
>CGI</ACRONYM
> script.
  For example, if the name of the CGI script is <TT
CLASS="filename"
>search.en.cgi</TT
>,
  then it opens the template file
  <TT
CLASS="filename"
>/usr/local/mnogosearch/etc/<SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>search.en.htm</I
></SPAN
></TT
>
  (assuming that <SPAN
CLASS="application"
>mnoGoSearch</SPAN
> <TT
CLASS="filename"
>/etc</TT
>
   directory is <TT
CLASS="filename"
>/usr/locale/mnogosearch/etc/</TT
>).
  Configuring a multi-lingual interface consists of three simple steps.
  </P
><P
></P
><OL
TYPE="1"
><LI
><P
>&#13;      <P
><B
>Installing multiple templates</B
></P
>
      </P
><P
>&#13;      You need to create multiple search templates
      (one template for every language you want to support)
      with file names in the form 
      <TT
CLASS="filename"
>search.<SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>language</I
></SPAN
>.htm</TT
>, where
      <TT
CLASS="literal"
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>language</I
></SPAN
></TT
> is a two-letter language abbreviation,
      for example: <TT
CLASS="literal"
>en</TT
>, <TT
CLASS="literal"
>pl</TT
>, <TT
CLASS="literal"
>ru</TT
>.
      </P
><P
>&#13;      You may also want to have the file <TT
CLASS="filename"
>search.htm</TT
>
      (usually a sym-link to <TT
CLASS="filename"
>search.en.htm</TT
>) as the default file.
      </P
><P
>At the end of this step you will have these files
      in <SPAN
CLASS="application"
>mnoGoSearch</SPAN
> <TT
CLASS="filename"
>/etc</TT
>
      directory:
      </P
><DIV
CLASS="informaltable"
><P
></P
><A
NAME="AEN4187"
></A
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><TBODY
><TR
><TD
>&#13;                <TT
CLASS="filename"
>search.en.htm</TT
>
              </TD
><TD
>English template</TD
></TR
><TR
><TD
>&#13;                <TT
CLASS="filename"
>search.pl.htm</TT
>
              </TD
><TD
>Polish template</TD
></TR
><TR
><TD
>&#13;                <TT
CLASS="filename"
>search.ru.htm</TT
>
              </TD
><TD
>Russian template</TD
></TR
><TR
><TD
>&#13;                <TT
CLASS="filename"
>search.htm</TT
>
              </TD
><TD
>Symlink to the English template</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></LI
><LI
><P
>&#13;      <P
><B
>Installing front-ends</B
></P
>
      Put <TT
CLASS="filename"
>search.cgi</TT
> into your Web server
      CGI directory and setup the symlinks:</P
><DIV
CLASS="informaltable"
><P
></P
><A
NAME="AEN4210"
></A
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><TBODY
><TR
><TD
>&#13;                <TT
CLASS="filename"
>search.cgi</TT
>
              </TD
><TD
>The original file</TD
></TR
><TR
><TD
>&#13;                <TT
CLASS="filename"
>search.en.cgi</TT
>
              </TD
><TD
>symlink</TD
></TR
><TR
><TD
>&#13;                <TT
CLASS="filename"
>search.pl.cgi</TT
>
              </TD
><TD
>symlink</TD
></TR
><TR
><TD
>&#13;                <TT
CLASS="filename"
>search.ru.cgi</TT
>
              </TD
><TD
>symlink</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
></LI
><LI
><P
>&#13;      <P
><B
>Configuring Apache</B
></P
>
      You also need to make your <SPAN
CLASS="application"
>Apache</SPAN
>
      understand the trick you are doing here to have content negotiation
      happen, as well as some magic with the indexes.
      It can be done either in <TT
CLASS="filename"
>httpd.conf</TT
>,
      or in the <TT
CLASS="filename"
>.htaccess</TT
> file in
      the directory you put <SPAN
CLASS="application"
>search.cgi</SPAN
> in.
<PRE
CLASS="programlisting"
>&#13;AddLanguage en .en
AddLanguage pl .pl
AddLanguage ru .ru
DirectoryIndex search search.cgi
Options FollowSymlinks MultiViews
</PRE
>
      </P
></LI
></OL
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="multilang-how"
>How it works</A
></H2
><P
></P
><OL
TYPE="1"
><LI
><P
>You open your browser and type the URL <TT
CLASS="literal"
>http://myhost/mydir/search</TT
>
        </P
><P
>&#13;          <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>(no slash at end !!)</I
></SPAN
>
        </P
></LI
><LI
><P
>Your browser says
        <TT
CLASS="literal"
>"I like English (well language negotiation en)"</TT
>
        </P
></LI
><LI
><P
>Apache finds
        <TT
CLASS="filename"
>search.en.cgi</TT
>:
        </P
><P
>&#13;        <B
CLASS="command"
>DirectoryIndex</B
> gives <TT
CLASS="literal"
>search</TT
>,
        and <B
CLASS="command"
>MultiViews</B
> gives
        <TT
CLASS="literal"
>en.cgi</TT
>)
        </P
></LI
><LI
><P
><SPAN
CLASS="application"
>Apache</SPAN
> sets the
         environment variable <CODE
CLASS="varname"
>SCRIPT_FILENAME</CODE
> to
         <TT
CLASS="filename"
>mydir/search.en.cgi</TT
> and executes
         <SPAN
CLASS="application"
>search.en.cgi</SPAN
>.
        </P
></LI
><LI
><P
><SPAN
CLASS="application"
>search.en.cgi</SPAN
> starts
         and detects the template name using 
         <CODE
CLASS="varname"
>SCRIPT_FILENAME</CODE
>.
        </P
></LI
></OL
><P
>So what happens if the user wants, say, German?
    Note, there is no <TT
CLASS="filename"
>search.de.cgi</TT
>!
    The first bit of <B
CLASS="command"
>DirectoryIndex</B
> (i.e. <TT
CLASS="filename"
>search</TT
>) fails,
    so <SPAN
CLASS="application"
>Apache</SPAN
> tries the second one, <TT
CLASS="filename"
>search.cgi</TT
>
    and executes it. <SPAN
CLASS="application"
>search.cgi</SPAN
> starts and opens the template
    file <TT
CLASS="filename"
>search.htm</TT
>, which is a symlink to <TT
CLASS="filename"
>search.en.htm</TT
>.
    So you'll get the page in English, which is better than a <TT
CLASS="literal"
>404 Not Found</TT
>.
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="multilang-problem"
>Possible troubles</A
></H2
><P
>Rarely you may get some language negotiation problems caused by:
    </P
><P
></P
><UL
><LI
><P
>Caches (proxy servers) that don't follow the standards
        </P
></LI
><LI
><P
>Old versions of browsers that don't follow the standards
        </P
></LI
><LI
><P
>Bad browser configuration with weird stuff in language settings.
        </P
></LI
></UL
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="msearch-international.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="msearch-cjk.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Multiple languages support</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="msearch-international.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Segmenters for Chinese, Thai and Japanese languages</TD
></TR
></TABLE
></DIV
><!--#include virtual="body-after.html"--></BODY
></HTML
>