14.1 Working with Multiple Languages

Customizing your search solution is important only if you want to let your users conduct language-specific searches. You specify the language of a template by inserting a language identifier in the meta tag of your templates or HTML files. The language identifier can also be used in Search Results pages to let users quickly recognize the search results that interest them.

QuickFinder Server also lets Web clients specify their locale at the time the search query is entered. The default Search page illustrates this feature by auto-detecting a user’s locale and selecting the appropriate language from the Display Language drop-down list. This selection sends two parameters to the QuickFinder Server: language and country. The country parameter is almost always blank. The search engine uses this information to find locale-specific versions of the templates used to return search results.

To specify the language of a template or of any HTML content that is indexed as part of your virtual search server, you must specify a language identifier within an HTML file’s header section. For example, if you wanted to identify a Russian template, you would add the following meta tag:

<meta http-equiv=”Content-Language” content=”ru”>

In some cases, such as Traditional and Simplified Chinese, you need to use the two-character, uppercase country codes. For example:

<meta http-equiv=”Content-Language” content=”zh-TW”><meta http-equiv=”Content-Language” content=”zh-CN”>

The first line of the example indicates the Chinese language (ZH) and the geographic location as Taiwan. The second line of the example indicates the Chinese language (ZH) but China as the geographic location.

This combination of language and country codes is called a locale. For more information about locales, refer to Section 14.4, Additional Resources.

14.1.1 Specifying Locales within Template Filenames

QuickFinder Server consists of three primary servlets: SearchServlet, PrintServlet, and AdminServlet. Each servlet returns information to the Web client by using server-side templates. Templates are stored at /<searchroot>/Templates where searchroot is the path where you installed QuickFinder. The default install location is /var/lib/qfsearch. For more information about templates, see Section 11.0, Understanding Templates.

After determining a Web client’s locale, QuickFinder attempts to locate a matching search result template. That is, each of the QuickFinder services automatically attempts to locate a version of the requested template that most closely matches the Web client’s locale.

IMPORTANT:QuickFinder cannot find locale-specific templates without the two-character language code and the optional two-character country code. See Section 14.4, Additional Resources for more information about language code syntax.

For example, if a Web client requests to see search results by using the ResultListTemplate.html file and the client is a Chinese language user from Taiwan and the server is Russian, then QuickFinder tries to find a Chinese-Taiwan version of the template first (ResultListTemplate_zh_TW.html) because that exactly matches the client’s language and country. The following table lists the template names the system looks up in this example in order of priority.

Table 14-1 Template Name Priority (Chinese-Taiwan)

Template Name

What QuickFinder Concludes

1. ResultListTemplate_zh_TW.html

Specific client locale

2, ResultListTemplate_zh.html

Simplified client locale

3. ResultListTemplate.html

Client requested name

4. ResultListTemplate_ru.html

Specific server locale (no simplified versions)

5. ResultListTemplate_en.html

English language version

6. ResultListTemplate.html

Up to the first underscore ( _ )

If this scenario were reversed so that the search client was Russian and the server was Chinese (Taiwan), and the client requested the ResultListTemplate_ja.html template, then the lookup order follows the order shown in the following table.

Table 14-2 Template Name Priority (Japanese)

Template Name

What QuickFinder Concludes

1. ResultListTemplate_ja_ru.html

Specific client locale (no simplified versions)

2. ResultListTemplate_ja.html

Client requested name

3. ResultListTemplate_ja_zh_TW.html

Specific server locale

4. ResultListTemplate_ja_zh.html

Simplified server locale

5. ResultListTemplate_ja_en.html

English language version

6. ResultListTemplate.html

Up to the first underscore ( _ )

All templates undergo this rigorous lookup system. When a template is located, its name is stored and associated with the original client locale so that all subsequent requests for that template from the same locale automatically find the template without performing the same rigorous lookup.

No further lookups are attempted for that combination of client locale and template name until the QuickFinder Server is restarted. If all template lookups fail, then an error message is returned to the client performing the search.