Top
Convert Whatfix data to a format accepted by the custom tool
  • 08 Oct 2024
  • 1 Minute To Read
  • Dark
    Light
  • PDF

Convert Whatfix data to a format accepted by the custom tool

  • Dark
    Light
  • PDF

Article summary

Whatfix content must be converted into a format so that the translation tool can receive and interpret the data. This includes to and from language, translation attributes and other details to uniquely identify the content and the fields in the content that require translation.

Note:

The integration setup for the following topics uses Microsoft Azure as an example. Based on your requirements and the tool of your choice, setup the integration accordingly.

Use the following steps to convert Whatfix data to a format accepted by the custom tool:

Note:

Refer to the Translation Tool Guidelines to learn about Javascript and Request parameters while configuring the steps for the custom translation tool.

  1. In the Convert Whatfix data to format accepted by the custom tool section, enter a Description (Optional). By default, the Configuration type is set to Javascript.

  2. In the Script field, enter the Javascript code to convert Whatfix data into a format accepted by the custom translation tool.

    Here’s an example Javascript code for Microsoft Azure:

    function convertToMicrosoftTranslationInput(original_data) {
        var inputForMs = [];
        for (var i = 0; i < original_data.length; i++) {
            var item = original_data[i];
            inputForMs.push({
                "Text": item.value
            });
        }
        return inputForMs;
    }
    
    var microsoftTranslationInput = convertToMicrosoftTranslationInput(attributes.translationStrings);
    // Here we can see that strings that need to be translated can be accessed by attributes.translationStrings
    output.data = microsoftTranslationInput;
    

Note:

The JS Script code editor only supports versions earlier than ES6. For more information about specifying variables and parameters, see Translation Tool Guidelines.

The preceding Javascript code reads the translationStrings from Whatfix, formats it into a structure that Microsoft accepts, and saves the result in a variable called output.data for the next step.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.