Skip to main content

ITranslationService Interface

Defines the interface used to access a remote translation service.


export interface ITranslationService


The following code snippet demonstrates how to implement the ITranslationService interface and pass it as a parameter to the registerTranslationService function:


The complete sample project How to Use the Microsoft Azure Translator Text API in Report Localization is available in the DevExpress Examples repository.

function BeforeDesignerRender(s, e) {
    DevExpress.Reporting.Designer.Localization.registerTranslationService("AzureCognitiveService", {
        onRequest: (texts, language) => {
            var data = { 'Texts': => ({ 'Text': text })), 'Language': language };
            return {
                type: "POST",
                url: '/Home/GetAzureTranslationService',
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                processData: true,
                data: JSON.stringify(data),
                error: function (xhr) {
                    DevExpress.ui.notify(xhr.statusText, "error", 500);
        onResponse: (data) => {
            if (data.error && data.error.message) {
                DevExpress.ui.notify(data.error.message, "warning", 500);
                return [];
            return (item) {
                return item.translations[0].text


onRequest Property

Specifies a function that is called before a HTTP request is sent.


onRequest: (texts: string[], destinationLanguage: string) => JQueryAjaxSettings

Property Value

Type Description
(texts: string[], destinationLanguage: string) => JQueryAjaxSettings

Specifies a function that takes an array of strings and a string and returns a JQueryAjaxSettings object that is a set of key/value pairs that configure the Ajax request.


The specified function should construct an Ajax request for a remote translation service.

onResponse Property

Specifies a function that is called when a HTTP response is received.


onResponse: (result: any) => string[]

Property Value

Type Description
(result: any) => string[]

A function that takes a response result value and converts it to an array of strings.


The specified function should convert information received from a remote translation service to an array of text strings.