Back to Devexpress

ASPxClientCustomizeLocalizationEventArgs Class

xtrareports-js-aspxclientcustomizelocalizationeventargs.md

latest4.3 KB
Original Source

ASPxClientCustomizeLocalizationEventArgs Class

Provides data for the ASPxClientReportDesigner.CustomizeLocalization, ASPxClientWebDocumentViewer.CustomizeLocalization and ASPxClientQueryBuilder.CustomizeLocalization events.

Declaration

ts
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

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

Parameters

NameTypeDescription
callbacksJQueryPromise<any>[]

Callbacks that return arrays with localization strings.

|

Properties

WidgetLocalization Property

Declaration

ts
WidgetLocalization: DevExpress.localization

Property Value

Type
localization

Methods

LoadMessages(messages) Method

Loads the specified localization strings synchronously.

Declaration

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

Parameters

NameTypeDescription
messagesany

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

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

Parameters

NameTypeDescription
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:

js
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:

cshtml
<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"))