homefeaturesexamplesDOCUMENTATIONblogpricingcontact us
technical documentationCATI documentationcookbookrobot

Changing to another language programmatically

Problem

In the course of a questionnaire, you want to change to another language based on an answer to a previous question.

Solution

Use a CALCUL question as in:

    Q1
    % question
      [EN]In which language do you want to fill out the questionnaire?
      [FR]En quelle langue voulez-vous compléter le questionnaire?
    % note
    % categories
      [EN]English[FR]Anglais
      [EN]French[FR]Français
    % skips
    % condition
    % open-end
    ! ==================================================
    SWITCH CALCUL
    % question
      SWITCH =
      {
      $formdata{_lang} = ( $QLANGUE == 1 ) ? "FR" : "EN";
      $_callweb = _insere_dans_chaine("_lang",$formdata{_lang},$_callweb);
      }
    % note
    % categories
    % skips
    % condition
    % open-end
    ! ==================================================

Discussion

The $_lang system variable controls the language in which the questionnaire is displayed. It contains a two-letter code from the ISO classification of languages.

The CALCUL question above attributes "EN" to $_lang if Q1 equals 1 and "FR" otherwise. This scheme can be extended to more languages or other sources of data such as prepopulated information: if you have imported information on the respondent's preferred language of communication, you can use it in a similar CALCUL to adjust the language of the questionnaire accordingly.

   

e-mail technical support!