Integrate with a translation service provider
Integrate with a third-party translation provider of your choice for machine translation of user-generated text.
Before you begin
Create an account with your third-party translation service provider, and obtain the connection and credentials needed for integration.
Role required: admin
Procedure
-
Navigate to All > Process Automation > Workflow Studio, then select New to create subflows to detect the language of the input text and translate the input text, as well as actions, using the following guidance.
For information, see Workflow Studio.
-
Map error codes from your machine translation provider to the error codes and standardized error messages supported by ServiceNow.
Table 1. Standard error codes and message Error code Error message 40050 Error code to populate error messages from the machine translation provider instead of standardized error messages. 40051 Unknown error occurred. 40052 Text ('text' field) has exceeded its maximum length. 40053 Source language is invalid. 40054 Target language is invalid. 40055 Request is not authorized because credentials are missing or invalid. 40056 Text cannot be translated to target languages. -
Ensure that the inputs and output fields are in the following format for subflows.
Note:When creating subflows, you can refer to the subflows that are available by default if required. For example: Detect Language [detect_language_v4] and Translate Text [translate_text_v3]. For more information, see Migrate customized Translator Configurations to v4 flows.
Table 2. Detect subflow Field name Description Type Inputs texts Input texts whose language should be detected. Version v3 supports bulk detection (detection of multiple texts input in a single string). With the Xanadu Patch 3 release, version v4 supports Exclusion Framework as well as bulk detection.
Array.String Outputs detections Information about the code and confidence of the languages detected by the translator and their respective alternatives, error codes, and error messages. - Code: Language code of the detected language as specified by the translation service provider.
- Confidence: Value that indicates the confidence in the result. The value is between zero and one. A low value indicates a low confidence.
For example, French text with confidence of 0.93{ 'code' : 'fr', 'confidence' : '0.93' }For more information refer to the getDetectedLanguages section of DynamicTranslation - Scoped.
Array.Object. Each element of the Object is a String value. status Status of the request. Choice Table 3. Translate subflow Field name Description Type Inputs texts Texts to be translated. Version v3 and above support bulk translation (translation of multiple texts input in a single string).
Array.String target_languages Array of language codes to which the text needs to be translated. For example,['fr','it']Array String. Each element of the array is a String value. source_language Language code of the source text. For example,enString additional_parameters Array of additional parameters. For example,[{'parameter_name': 'textType', 'parameter_value': 'html'}]Array.Object. Each element of the array is an Object with String values. Outputs translations Translated texts in the specified target languages. Each element of the array is an Object containing target language and the translated text. For example,[ {'target_language':'fr', 'translated_text':'Bonjour'}, {'target_language':'it', 'translated_text':'ciao'} ]For more information refer to the getTranslations section of DynamicTranslation - Scoped.
Array.Object. Each element of the array is an Object with String values. status Status of the request. Choice Note:Ensure that the Run As field is set to User who initiates session in the flow properties.
-
Map error codes from your machine translation provider to the error codes and standardized error messages supported by ServiceNow.
-
Create a custom translator configuration for your service provider in the Translator Configurations table, and set the record to active.
When you create the record in the Translator Configurations table, search for the subflows you created in the previous step..
- Optional:
If your instance is on Xanadu Patch 3 or higher, and you intend to use Exclusion Framework, enter your translation provider's exclusion tags in the Exclusion Provider Pattern table.
Refer to your provider's documentation to obtain these tags. For more information about entering the tags, see Add an Exclusion Provider Pattern.
- Optional:
Create a language code mapping to associate your provider's language codes to ServiceNow language codes.
For more information, see Create a language code mapping.
What to do next
For information about APIs, see DynamicTranslation API.