Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Multiple-language scripts > Setting the interview language
 
Setting the interview language
The interview language controls the language in which questions, answers, and other texts are displayed, and also format in which decimal and date responses must be entered.
When a respondent starts an interview and the interviewing program has no information about the respondent’s language, it tries to find a suitable language for the interview:
1 It checks whether the questionnaire file contain texts in the respondent’s browser language and, if so, uses that language. If the respondent has a list of languages set in their browser, only the first language is checked.
2 If the questionnaire does not contain texts in the respondent’s browser language, the interviewing program uses the texts in the questionnaire’s base language (the default language set when the project was activated).
For example, suppose the questionnaire is defined in English (the base language) and Spanish. Participants whose browsers are set to work in Spanish see Spanish texts and must enter decimal numbers with a comma as the decimal point. Everyone else sees English texts and must enter decimal numbers with a dot as the decimal point.
A better approach is to set the interview language in the script, either by asking a direct question or by extracting the respondent’s language from the sample record.
To set the language based on a direct question, define the list of available languages in the metadata section:
InterviewLanguage "In which language would you like to be interviewed?"
Each language has its standard three-character code as its name as this is required for setting the language in the routing section. In general you can set languages using their three-character code, as here, or their RFC 1766 format (en–gb or fr–fr, for instance). The interviewing program converts three-character references to RFC 1766 format.
In the routing section, set the chosen language as the interview language with:
IOM.Language = <question_name>.Categories[<question_name>].Name
where <question_name> is the name of the language question. For example:
InterviewLanguage.Ask()
' Set the interview language
IOM.Language = InterviewLanguage.Categories[InterviewLanguage].Name
' Force comma for decimal places and yyyy-mm-dd dates
IOM.Locale = 1045 ' Polish locale
If the respondent’s preferred language is defined in the sample record, you can import it from there. For example, if the preferred language is stored in the Language sample field, you would type:
IOM.Language = IOM.SampleRecord["Language"]
For more information, see Using sample data in interviews.
The interview scripting language accepts setting the interview language to any language that you want. However, the interviewing program requires the questionnaire (.mdd) file to contain that language even if there are no translations for it yet. If the script instructs the interviewing program to use a language that does not exist in the questionnaire file, the interviewing program writes a warning to the IVW*.tmp log file and then continues the interview using the default language that was set during activation. The warning says “Language 'xxx' is not available, using 'yyy' instead”.
See also
Multiple-language scripts