In your account manager's Language setting (under the Designing Topics),
you can set one language for your search results display. But what if
your site is multilingual?
You can also set the language
display per query box, so for example you can have a search box that
leads to Spanish results on your Spanish documents, and a search box
that leads to English results on your English documents. This is a
simple way to get the most out of having just one search engine that
will find words in different languages on different parts of the same
website. Remember, PicoSearch finds words, it doesn't care what
language they're in!
The language override selector for your search box code looks like this:
The
language is Spanish in this example, to override an account that has
its language set to be English. The language value can be any of the
currently available language names in the Languages multiple choice of
your account manager. Just look at the possible values without actually
picking one, and substitute it into the code line above. For languages
that have a clarifying name in parentheses, like "Portuguese
(Portugal)", use the word that is in the parentheses (thus, "Portugal"
is the VALUE that will override the search display).
Now
you are ready to insert this override code into your search box code.
Get the search box code from the "How to Add a Search Box" choice in
your account manager, and when you put it into your web pages, insert
the additional INPUT line like in the following example.
Now when that box is used to search your web pages, the
results will be reported in Spanish, or whatever is the value of the
override language!
Note that you shouldn't just cut and paste the code above because it
won't have your account settings. At least put in your account ID.
Note also that if you are including a help text link on your own
page, you will also need to set an override language in that help
link's url by adding "〈=Spanish" to the end, for example. If you have
any doubts, just set the language in the account manager for the whole
account and see what the link does at "How to Add a Search Box".
Making a drop-down selection:
You could even include a combo box in your starting search code to allow
the user to pick their own search language. Just add a table row with a
select box for the lang variable to your HTML, like in the following
section of code.
<tr><td></td><td align="right" colspan="2"><select
name="lang"><option selected="selected" value="English">Search
in English </option><option value="Spanish">Search in
Spanish </option><option value="French">Seach in French
</option><option value="German">Seach in German
</option></select></td></tr>
You get:
Keep in mind of course that this only works as well as your site is
containing separate language words that can easily be found. If you
wanted to more exactly separate your site into different language
sections, you might be better off with separate partitions (see FAQ on Partitions) or even separate search engines (use a combo box to select the Index number for the account).
Notes for Professional and Premium Accounts:
• The Hit Highlighter feature has its own way to support multiple languages, see the Highlighter FAQ.
• You can also build your template with a language dependency for
different displays. Whenever the "lang" value is provided for a search
(see above), any occurence of the keyword _PICOLANG in your template
will be replaced with the lang value. Otherwise, _PICOLANG will be
erased. This means that your English template could have file names
like menubar_PICOLANG.gif in it, so that the Spanish version would use
menubarSpanish.gif for a Spanish display, while the English searches
would default to using the menubar.gif image. This way you will always
have only one design to maintain, but with as many language appearances
as you generate selectable images for! (For further customizing
possibilities, try picocaller args in FAQ on template codes.)
• If you work with a non-Western character set, then since you control
your own template, you have probably hardcoded the character set you
want in the template. If you are also dynamically switching languages
with the lang variable, PicoSearch will override the http-equivalent
charset of your template, but only if the lang variable specifies a
non-Western language. PicoSearch tries to not meddle with your template
unless it thinks it has to. So if you have a problem with language
overriding, just try taking out your http-equiv to see what PicoSearch
will do. See FAQ on charset. (For further customizing possibilities, try picocaller args in FAQ on template codes.)