Skip to main content

ASPxClientCustomizeLocalizationEventArgs Class

Declaration

declare class ASPxClientCustomizeLocalizationEventArgs extends ASPxClientEventArgs

Remarks

ASPxClientCustomizeLocalizationEventArgs objects are automatically created, initialized and passed to corresponding event handlers.

Inheritance

ASPxClientEventArgs
ASPxClientCustomizeLocalizationEventArgs

constructor

Initializes a new instance of the ASPxClientCustomizeLocalizationEventArgs class with the specified settings.

Declaration

constructor(
    callbacks?: JQueryPromise<any>[]
)

Parameters

Name Type Description
callbacks JQueryPromise<any>[]

Callbacks that return arrays with localization strings.

Properties

WidgetLocalization Property

Declaration

WidgetLocalization: DevExpress.localization

Property Value

Type
localization

Methods

LoadMessages(messages) Method

Loads the specified localization strings synchronously.

Declaration

LoadMessages(
    messages: JQueryPromise<any> | any | null
): void

Parameters

Name Type Description
messages any

An object that provides localization strings.

Remarks

Use the LoadMessages method to localize reporting controls in ASP.NET Core or JavaScript-based applications. This method allows you to load JSON files obtained from the DevExpress Localization Service.

Refer to the following topic for more information: Localize Reporting Components for Web

SetAvailableCultures(cultures) Method

Specifies languages available for report localization and displayed in the Language drop-down list.

Declaration

SetAvailableCultures(cultures: { [key:string]:string }): void

Parameters

Name Type Description
cultures {[key: string]: string}

A dictionary that is an object composed of key-value pairs.

Remarks

The cultures parameter is a set of (culture code) - (culture name) pairs:

var availableCultures = {"ar": "Arabic", "de": "German", "fr": "French", "zh-Hans": "Chinese (Simplified)","zh-Hant": "Chinese (Traditional)","pt-BR": "Portuguese (Brazil)", "pt-PT": "Portuguese (Portugal)"};

The specified languages are displayed in the Localization Editor as shown below:

Example

Note

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

The following code specifies a subset of languages and cultures that .NET supports. These languages are available in the Azure Cognitive translation service:

<script>
function CustomizeLanguages(s, e) {
    var supportedKeys = ["ar", "zh-Hans", "zh-Hant", "en", "fr", "de", "hi", "ja", "pt-BR", "pt-PT", "ru", "es"];
    var availableCultures = supportedKeys.reduce(function(result, item) {
        result[item] = DevExpress.Reporting.Metadata.availableCultures()[item] || item;
        return result;
    }, {})
    e.SetAvailableCultures(availableCultures);
}
</script>
@(Html.DevExpress().ReportDesigner("reportDesigner")
    .Height("1000px")
    .ClientSideEvents(x =>
    {
        x.CustomizeLocalization("CustomizeLanguages");
    })
          .Bind("TestReport"))