In this article
1: Overview
To enable batch translations from Data Processing (DP), you can use the DP Custom Code Library (CCL) method. This CCL method sends a POST request to a “translation” survey with the text to be translated. The survey then uses the native translation scripting function (GoogleTranslateText or MicrosoftTranslateText) and returns the translated text.
2: Translation Survey Setup
2.1: Import the Survey Definition
Start by importing the survey definition. Click here to download the translation survey definition .zip file.
2.2: Configure Translation Service:
Refer to the Note-node in the survey for instructions on acquiring a Google/Microsoft key and adding it to Company settings.
Comment out/uncomment the script node for the translation service you wish to use.
Note: Any errors during DP execution will be written to the error variable.
2.3: Launch and Access Survey:
Launch the translation survey.
Add a respondent to the survey and copy the unique respondent link.
3: Data Processing Setup
Now you can create a Data Processing rule to run the translation:
Use the Survey Database as both the source and target.
Include the survey ID for the data collection survey containing the data to be translated. Ensure this survey has fields where translations can be written.
Set up a column filter with the fields to translate from and the target fields.
Use the following action script to run the translation (replace with the correct respondent link):
result= DPTranslator.Translate(
"https://survey.nordic.confirmit.com/wix/pXXXXXXXXXXXX.aspx?_sid_=0wIxYOGiSzhQ5QlPT6uP6fNCXFnzhJ1oai8HAR_TziVI-X6Q6M3ZBTRGyGkYOdWf2UHYyW9qB6Jm8iVGz2MFNZ-GovMwQkCNuA9Ulzi4iqg1",
textToTranslate, // variable that holds the text to be translated
-1, // Source lang (-1 = identify language automatically)
9 // target lang
);
3.1: Example
You are now ready to execute the translations. Please note that the "Validate Action Script" feature does not work with custom code and will result in an error, but running the rule will still work correctly.