Top
Convert the Format from Custom Tool to Whatfix Data
  • 08 Oct 2024
  • 1 Minute To Read
  • Dark
    Light
  • PDF

Convert the Format from Custom Tool to Whatfix Data

  • Dark
    Light
  • PDF

Article summary

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.

  1. In the Convert format from custom tool to Whatfix data 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 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.

  3. 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.


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.