Latest News

ServiceNow Translation Automation with DeepL – by Christian Zyweck and Tobias Schwartz

Motivation

ServiceNow’s customers are global, with significant usage in countries where English is not the primary language. Communication issues due to language barriers can have significant impact on an organisation’s efficiency, profitability, as well as customer’s experience of their products and services. The requirement for global enterprises to effectively connect with their customers and employees across languages in real time is becoming a real need on the platform.

ServiceNow recently improved their localization framework on the Now Platform that can automate translations of text in catalog items, virtual agent topics and other text records appearing in the platform. TMLabs have recently released an enterprise-ready integration with DeepL®, one of the world’s leading translation services designed to complement and extend ServiceNow’s native capabilities.

This article will show how to enable ServiceNow’s localization framework with TMLabs’ free DeepL Translation Service Spoke application to unlock the full potential of translation automation using machine learning.

Setup

The first step is to ensure the following basics are configured, including your subscription to DeepL and ServiceNow. This article will describe the setup on a ServiceNow Quebec instance with a ServiceNow ITSM Standard subscription.

Activate the following plugin by installing one language package: com.glide.localization_framework.installer (Localization Framework Installer).
In this example, the instance has the German and Spanish language packs enabled, which preinstalls the required plugin “Dynamic Translation”. Please check the current supported languages from DeepL before considering installing a particular language pack.

Install the free “DeepL Translation Service Spoke” from the ServiceNow Store and set it up as per the installation guide. The Overview page will also assist with the setup by providing prescriptive guidance.

As a next step, set up a translation group that will be assigned to all translation tasks. This group will be necessary if a translation fails or if a manual translation workflow is chosen. Assign to that group the “localization fulfiller” role and all required users.

Configuration

Navigate to “Localization Configuration” > ”Insights” and click “Generate Insights Records”.

Navigate to the “Insights Dashboard” to validate the current translation status.

Create a translation setting in “Settings”, that uses the DeepL translator for “Machine Translation”:

 

 

 

Navigate back to the dashboard to view in the “Catalog Item Translations” chart one of the “Partially Translated” or “Not Translated” records.

Choose one of the records and open it, then click “Request Translations”. Select all languages that are missing and then submit.

The status message “You successfully requested for translations” confirms your submission. In the next step the progress can be checked on the “My Task” list after removing any filters:

Error Handling

If any error occurs, check the configuration and try to manually reprocess the translation by opening the failed translation task and try to reprocess the translation by clicking the “Translate” button on the form. It will fail on the first attempt to show you the original error. Simply click the “Machine Translate” button to complete the remaining translations.

In a final step click “Publish Translation” to publish the translations.

Advanced Automation

The described setup enables automation in terms of creating translations but not in terms of maintaining the translations automatically. Over time new Catalog Items or Virtual Agent topics will be added or updated. With the help of scheduled jobs, the manual steps as shown in the previous chapter can also be automated. Be aware, that the following steps can lead to an increased license cost or can consume available capacity quicker.

Make sure that the scheduled job “sn_lf_GenerateLocalizationInsightsRecords” is enabled and running regularly. Usually is it running every Sunday.

Create a new scheduled job that will run once the scheduled job “sn_lf_GenerateLocalizationInsightsRecords” completes as shown below.

The script will be as per the following and is basically a copy of the scripted REST API of the localization framework. Validation and update of it may be required after every upgrade of ServiceNow.

 

var utils = new LFUtils();

var sourceLanguage = utils.getDefaultSourceLanguage();

var lfConstants = new LFConstants();

var lfTranslations = new LFTranslations();

var lfArtifactUtils = new LFArtifactUtils();

 

var tableNameToInternalName = {};

var additionalInfo = {

“sourceLanguage”: sourceLanguage,

“sourceOfRequest”: lfConstants.INSIGHTS_REQUEST_TYPE

};

var translationRequestsFailedInsights = [];

 

var handleError = function(translationRequestsFailedInsights) {

var insights = new LFGenerateLocalizationInsights();

var failedInsightsLink = insights.generateInsightsLink(translationRequestsFailedInsights);

gs.error(gs.getMessage(“Your request for translations failed for the selected insights. Click {0}{1}here{2} to see the list of insights for failed requests and reinitiate the request.”, [“<a href='”, failedInsightsLink + “‘>”, “</a>”]));

};

 

var insightGR = new GlideRecord(‘sn_lf_insight’);

insightGR.addEncodedQuery(‘status!=1^ORstatus=NULL’);

insightGR.query();

while (insightGR.next()) {

var tableName = insightGR.table_name;

var internalName = tableNameToInternalName[tableName];

 

if (!internalName) {

// Insight records stores same table as of Artifact Configuration

var artifactConfigUtils = lfArtifactUtils.initFromTableName(tableName);

internalName = artifactConfigUtils.getInternalName();

tableNameToInternalName[tableName] = internalName;

}

try {

var result = lfTranslations.requestTranslations(internalName, [insightGR.document.getValue()], [insightGR.language.id.getValue()], additionalInfo);

if (result.status === “Error”) {

translationRequestsFailedInsights.push(insightGR.getValue(‘sys_id’));

} else {

gs.error(JSON.stringify(result));

insightGR.status = lfConstants.IN_PROGRESS_INSIGHTS_STATUS;

insightGR.percentage = lfConstants.IN_PROGRESS_INSIGHTS_PERCENTAGE;

insightGR.update();

}

} catch (e) {

translationRequestsFailedInsights.push(insightGR.getValue(‘sys_id’));

}

}

 

if (translationRequestsFailedInsights.length === 0) {

gs.info(gs.getMessage(“You have successfully requested for translations”));

} else {

handleError(translationRequestsFailedInsights);

}

 

This script will not create a localization insight, but instead will create and handle the translation task like it is done in the manual process. In this way it creates a log of every automated processed translation that has occurred.

Conclusion

The process as outlined above is generalised so it can be adapted and tailored to an organisation’s specific needs. Over time there might be improvements required, but this article has shown the potential of automated and machine-based translations. Customers and employees will directly benefit from a fully translated platform as a part of the internal and external experiences. ServiceNow’s out of the box capabilities combined with TMLabs’ “DeepL Translation Service Spoke” can enable your global communication requirements. Please give it a go and do not hesitate to reach out to TMLabs for an in-depth demo or implementation assistance.

Leave a Reply

Your email address will not be published. Required fields are marked *