Home > Fluid Dynamics Search Engine > Help > 1165

Dynamically changing the interface language

FDSE is available in multiple languages. The FDSE code itself is language-independent; during each execution, it selects a language from one of the available packages and uses that language for printing text to the screen. This selected language is known as the interface language.

Thanks to this multi-language support, you can control which language is used via a single setting found in the web-based Admin Page. In addition, you can allow each visitor to select his interface language via an HTML form. You can also configure FDSE to auto-detect your visitor's language preferences from browser settings.

Follow these steps to customize the interface language:

  1. Install FDSE version 2.0.0.0056 or newer. These instructions refer to some functionality introduced in the 0056 release.

  2. Login to your Admin Page and select "User Interface" from the navigation menu.

  3. On the User Interface page, scroll down to the section "Language and Locale Settings". There you can:

    • Review which language packages are installed.

    • Add new packages or update existing ones.

    • Select the primary interface language using the radio button.

      This primary setting will control the language on all admin pages. It will control the language on the public search pages when your visitors have not otherwise selected a language.

  4. Also on the User Interface page, in the group of settings at the top, is the setting "User Language Selection". Edit this setting to control whether visitors will be able to select a language via a form and/or whether their browser setting will be auto-detected.

  5. If you allow your visitors to select the interface language via a form, you will need to create a form that they can fill out. The name of the form element must be "set:lang" and the value must be the name of the language folder within:

    /search/searchdata/templates/

    Historically FDSE has named language folders with lowercase English-type names, like "italian" and "dutch". All new translations are named using the two-letter ISO code, like "ar" and "tl".

    Within FDSE templates, you can use a replacement variable named %lang_options%. This variable expands to a set of tags like <option value="english">English</option>. You can use this variable within your search form like so:

    <p>Diplay search interface in <select name="set:lang">%lang_options%</select>.</p>

    You can also directly set the "set:lang" variable within a URL.

    Examples include:

    Keyword:
    Display search interface in .

    http://www.xav.com/search.pl?set:lang=german (direct link to German interface)

  6. No special settings need to be made when auto-detecting the visitor language via the browser settings. FDSE will look at the first two characters of the HTTP_ACCEPT_LANGUAGE environment variable and attempt to map them to an existing language package.

Once you've allowed for visitor selection of the interface language, you should thoroughly test your system. Here are some things to keep in mind:

History: the "set:lang" form element was instroduced in FDSE 2.0.0.0054. Browser detection and the various web-based settings to control it were introduced in version 2.0.0.0056.

Ian Dobson provided the code for this functionality. Thanks Ian!


    "Dynamically changing the interface language"
    http://www.xav.com/scripts/search/help/1165.html