Top
Translation Tool Guidelines
  • 08 Oct 2024
  • 1 Minute zum Lesen
  • Dunkel
    Licht
  • pdf

Translation Tool Guidelines

  • Dunkel
    Licht
  • pdf

The content is currently unavailable in German. You are viewing the default English version.
Artikel-Zusammenfassung

Whatfix enables you to use Javascript (JS) and Request editors that accept data in a particular format. For example, the code editor does not accept request(), fetch(), and XMLHttpRequest requests.

Read this section to learn about the declaring variables and how to handle input and output parameters in your steps.

Note:

The parameters and declarations mentioned in this topic use Microsoft Azure as an example. Based on your requirements and the tool of your choice, setup the integration accordingly.

Javascript Code Parameters

Variable Access in JavaScript Code

To access variables such as source locale, target locale, and translation strings, use the following syntax:

  • Source Locale: attributes.sourceLocale

  • Target Locale: attributes.targetLocale

  • Translation Strings: attributes.translationStrings

Handle Output from Functions

After each JavaScript step, you must store the result of the function in the output.data variable. For example:

output.data = finalResult;

This declaration ensures that the result from the current step is saved and can be accessed in subsequent steps.

Access Input from Previous Steps

In each step, use the input variable to access the output from the previous step. For example:

var previousResult = input;

Request Parameters

Access Variables in a REQUEST Step

For a REQUEST step, use the following syntax to access variables:

  • Source Locale: ${attributes.sourceLocale}

  • Target Locale: ${attributes.targetLocale}

  • Translation Strings: ${attributes.translationStrings}

For example, in the URL you might construct the following:

https://api.example.com/translate?from=${attributes.sourceLocale}&to=${attributes.targetLocale}

Access Input in a REQUEST Step

In a REQUEST step, if you to access the input variable, use the following syntax:

${attributes.input}

Whatfix and Microsoft Azure Data Formats

Whatfix Data Format

The following code shows the format in which Whatfix stores the text that is to be translated:


"translation_strings": [
    { "key": "title_key", "value": "Original text" },
    { "key": "desc_key", "value": "Original description" }
]

Microsoft Azure Data Format

The following code shows the format in which Microsoft Azure stores the text:

[ 
{ 
"Text": "Original text"
 },
 {
 "Text": "Original description"
 }
 ]


War dieser Artikel hilfreich?

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.