All docs
V20.2
20.2
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Localization

  • 3 minutes to read

This document describes how to use JSON files from the DevExpress Localization Service to localize the Document Viewer and End-User Report Designer in JavaScript applications.

For information related to a particular JavaScript framework, review the following help topics:

Obtain JSON Files from the Localization Service

  1. Log into the DevExpress website.

  2. Open the DevExpress Localization Service.

  3. Select your target language, modify translations, and click the Download button. Refer to the Localization Service documentation topic for more information.

  4. Unpack the downloaded executable file to get the satellite assemblies and json resources directory. This directory contains the following JSON files required to localize the reporting controls (where xx is a culture name):

File Name

Localization Strings

dx-analytics-core.xx.json

Shared Components: Query Builder, Data Source Wizard, Filter Editor, Expression Editor

dx-reporting.xx.json

Web Document Viewer, End-User Report Designer and other reporting-specific components

Localize Knockout-based Applications

NOTE

The complete sample project How to Localize the Reporting Controls in a JavaScript Application with Knockout Bindings is available in the DevExpress Examples repository.

TIP

The component's UI is built on DevExtreme widgets, so to localize the editors you should also use one of the approaches described in the following topic: DevExtreme - Localization. Specify web server's thread culture to apply culture-specific formats to numbers and dates.

Use JSON Files from the Localization Service

Follow the steps below if you have a JavaScript application that uses Knockout bindings to integrate the End-User Web Report Designer or HTML5 Document Viewer components:

  1. Copy the dx-analytics-core.xx.json and dx-reporting.xx.json files to the application directory (in this example. ClientSide).

  2. Add the CustomizeLocalization callback to the View Model. The callback defines a JavaScript function that loads the localization strings from JSON files with the argument's LoadMessages method.

Client-side localization is the preferable approach. You can combine it with the custom localization approach described below.

const host = 'https://localhost:56742/',
    reportUrl = "Products",
    designerOptions = {
        reportUrl: reportUrl, 
        requestOptions: {
            host: host, 
            getDesignerModelAction: "/ReportDesigner/GetReportDesignerModel"  
        },
        callbacks: {
            // Handle the CustomizeLocalization event to load the DevExpress Localization Service JSON files.
            CustomizeLocalization: function (s, e) {
                e.LoadMessages($.get("/dx-analytics-core.de.json")); // Load files obtained from DevExpress Localization Service. 
                e.LoadMessages($.get("/dx-reporting.de.json")); // Load files obtained from DevExpress Localization Service.  
            }
        }
    };

ko.applyBindings({ designerOptions });

Localize Specific Strings

Call the UpdateLocalization method to localize specific strings.

You can use only this approach or combine it with the basic localization approach.

const host = 'https://localhost:56742/',
    reportUrl = "Products",
    designerOptions = {
        reportUrl: reportUrl,   
        requestOptions: {
            host: host, 
            getDesignerModelAction: "/ReportDesigner/GetReportDesignerModel"
        },
        callbacks: {
            // Handle the CustomizeLocalization event and call the UpdateLocalization method
            // to localize a particular string.
            CustomizeLocalization: function (s, e) {
                s.UpdateLocalization({ 
                    'Properties': 'TEST',
                    'Data Source': 'Datenquelle',
                    'Data Member': 'Datenelement'
                }); 
            }
        }
    };

ko.applyBindings({ designerOptions });

Use Satellite Assemblies

Specify the getLocalizationAction setting that is the path to the controller action that retrieves the localized strings. You can combine this approach with the custom localization approach.

NOTE

The code below is for the End-User Web Report Designer. You can use the same approach described in previous steps for the Document Viewer.

const host = 'https://localhost:56742/',
    reportUrl = "Products",
    designerOptions = {
        reportUrl: reportUrl,   
        requestOptions: { 
            host: host, 
            getDesignerModelAction: "/ReportDesigner/GetReportDesignerModel", // Action that returns the Report Designer model. 
            // Use this action to get the localized strings from the server.
            getLocalizationAction: "/ReportDesigner/GetLocalization" 
        }
    };

ko.applyBindings({ designerOptions });