Translations and Calculations

Calculations are often used in Illume surveys as a means to produce text. For example, a question might ask:

“How many years have you lived in your current house with your baby/babies?”

The programmer may want to pipe the appropriate text (baby vs babies), depending on a prior question that asks the respondent how many babies they have. If they have more than one baby, then ‘babies’ should be piped and if they have one baby, then ‘baby’. Typically, a calculation to produce this text would be created of ‘text’ data type, and the calculation would be as follows:

{Value:BABYQ}==1? “baby” : “babies”

This example is for a question called BABYQ that would ask something to the effect of “How many babies do you have?” and the question would have response options of 1 = One baby and 2 = More than one baby. This method works successfully in single language surveys. However, if a survey is to be translated into multiple languages, there is no interface within the Calculations editor to put the translated text.

To ensure that all text in a survey is translated, including the text outputted in a calculation, the programmer should utilize a combination of Survey Parameters and Calculations.

Any text that might be changed due to language should be put in a Parameter (directions on this are in the multi-control question section). In this example, there would be two parameters, one to output the word ‘baby’ and another to output the word ‘babies’. These parameters can be called BABY and BABIES respectively. To pipe the appropriate text into the question prompt, the programmer will utilize the “DatStat.GetParameter” function. The above calculation (let’s assume this is called NUMBABIES) will now be:

({Value:BABYQ}==1)?DatStat.GetParameter(“BABY”): DatStat.GetParameter(“BABIES”)

The appropriate language will automatically be pulled into the calculation. This calculation can then be piped into the prompt of the BABYQ question as:

“How many years have you lived in your current house with your {Value:NUMBABIES}?”