PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

[ hack ] multilanguage searchform

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [ hack ] multilanguage searchform

    hi, I'm not shure if this ever suggested.
    While build up a two language offline site for CD with javaScript Search, I needed for both languages (german and english) 2 searchforms.
    Due I can only choose one zlang file from the indexer, it's not possible to set more languages.
    Here is the trick (excuse me if that is not new):

    1. setup a search with english language (or any other) and generate all necessary files (search index and all the other js files)
    2. setup a second indexing with the other language at example choose the german zlang file and generate the searchfile BUT choose another location and dont overwrite the first index/searchfiles!!!!
    3. the translation variables are stored into search_index.js at the end of file. so copy out this part of the second generated search_index.js file.
    it looks like this:
    Code:
    var STR_FORM_SEARCHFOR = "Suche nach:";
    var STR_FORM_SUBMIT_BUTTON = "Abschicken";
    var STR_FORM_RESULTS_PER_PAGE = "Ergebnisse je Seite:";
    ...
    copy all that variables to a new js file called search_d.js and include it on the german (or any other second language) part of your website with
    Code:
    <script language="JavaScript" src="search_d.js"></script>
    right after the other included search related js files.
    so the language vars from the included search_index.js which holds the english language vars, will be overwritten by the new included search_d.js, which holds the same variables with german content.

    ACHTUNG! search results will be listed for both languages if there is no category for each language set up!
    just the search form is different!

    hope you can follow this description, my english is not so good.
    I did not try the asp/php/cgi based search, maybe there is a similar way.

    I did not choose the way to build my own search form and suspress the zoom generated form, because the resultpage contain no search form anymore.

    maybe it is possible for further versions, to generate separate and different translation files, to include them as needed.

    Zoom search is really good!
    best
    marcus

  • #2
    We would generally not recommend editing the index files like this.

    For people who want search forms in multiple languages we would recommend the following,

    1) Create a Zoom configuration file per language required

    2) For each configuration file set a different output directory and language file (from the languages tab in the configuration window). Setting a different output directory means the index files don't overwrite each other.

    3) Have a different sub-directory on your CD (or web site) for each language and place the search files in these subdirectories. e.g.
    /french/search/
    /german/search/

    Having a different sub-directory per language avoids the hack above, which is only required if you can't make a sub-directory. This method will also work with ASP, PHP and CGI.

    ----
    David

    Comment

    Working...
    X