- 08 Oct 2024
- 1 Minute zum Lesen
-
Drucken
-
DunkelLicht
-
pdf
Convert the Format from Custom Tool to Whatfix Data
- Aktualisiert am 08 Oct 2024
- 1 Minute zum Lesen
-
Drucken
-
DunkelLicht
-
pdf
The translated content received from the translation tool needs to be restructured to align with Whatfix's data format.
Use the following steps to convert the format from the custom translation tool to Whatfix data:
Note:
Refer to the Translation Tool Guidelines to learn about Javascript and Request parameters while configuring the steps for the custom translation tool.
In the Convert format from custom tool to Whatfix data section, enter a Description (Optional). By default, the Configuration type is set to Javascript.
In the Script field, enter the Javascript code to convert the format from the custom tool to Whatfix accepted format.
Here’s an example Javascript code:function mergeTranslatedValues(original_data, translated_data) { var result = []; for (var i = 0; i < original_data.length; i++) { var originalItem = original_data[i]; var translatedItem = translated_data[i]; result.push({ key: originalItem.key, value: translatedItem.translations[0].text }); } return result; } var mergedData = mergeTranslatedValues(attributes.translationStrings, input); // Output of previous step can be accessed by using input keyword output.data = mergedData;
The preceding Javascript code merges the translated text from Microsoft Azure with the original keys from Whatfix, and can display the translated text correctly.
Once you have filled out all the necessary details in the Setup section on the Translation Tools page, click Save.
To complete the integration process, activate the custom integration tool in the Translation tools page.