This script article allows a custom error message added by a script (not system error messages built into the application) if you are building a multi-language study.
Note:
- The script used in this article cannot be used by itself. This is to be implemented after some kind of validation script is added.
- The language you want to translate to must be installed on your community and enabled in your study.
Example
You have added a validation script How do I ensure a Date question cannot be set to a future date? and you would like to translate the error message added by this script.
Detailed Steps
- Create a Single Choice Question called ERR_MSG.
- Hide this question so that respondents do not see this in the survey.
- Add an answer to this question with default error message text.
You will be able to find the default error message in English within the script you used for custom validation. Look for the keyword "NewError" and it should look something like this:NewError("English Error Message Here");
For the example above, "Please do not enter a date in the future." without the quotation mark. - Click save and switch the language in the authoring view by changing the language on the drop down list above the question text area.
Note: If you do not see the languages you want in the dropdown, please see the How to enable languages in a study section further below. - Now you will see blank in the answer text because it's not translated yet. Add the translated text to the same answer. Do not change the precode.
- Click Save. Repeat step 3 to 5 for all languages required.
- Copy below code and replace the error message with the double quotations in the validation script.
ERR_MSG.FindAnswerByCode("PRECODE").Html
- Change the PRECODE to match the precode of the answer text in ERR_MSG. e.g. 1.
Example before:
Example after: - If you have more than one error message to translate in the same study, keep adding onto the answer list of ERR_MSG question. Repeat step 3 to 7.
- Click Save.
- Validate and test your survey.
How to enable languages in a study
Make sure to enable the language you want to translate to. You can check on the Languages tab to see if they are enabled. Status should either be In progress or Completed.
More Information
Read this WebHelp article to learn more about Selecting Languages.
Comments
0 comments
Article is closed for comments.