xtrareports-400932-web-reporting-common-features-localization-localization-in-asp-net-core-reporting-applications.md
You can create localizable reports. Users can select a language to translate report content in the viewer, on the printed page, and in exported files. See the Localize Reports section for information on how to do this.
Additionally, you can localize the user interface in the Document Viewer and End-User Report Designer. See the Localize the User Interface section for information on how to do this.
This section describes how to use JSON files from the DevExpress Localization Service to localize the Document Viewer and End-User Report Designer in ASP.NET Core applications.
Log into the DevExpress website.
Open the DevExpress Localization Service.
Select your target language, modify translations, and click the Download button. Refer to the following help topic for detailed information: Localization Service.
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):
Localize dates, numbers, currencies, and Devextreme widgets that are part of the Reporting component, as described in the following help topic: DevExtreme jQuery - Localization.
Do the following if you have a .NET Razor-based ASP.NET Core application and use the ReportDesigner or WebDocumentViewer extension method:
Copy the dx-analytics-core.xx.json, dx-reporting.xx.json, and dx-rich.xx.json (optional) files (where xx is the language identifier) to the application directory (for instance, wwwroot).
Open the View file and disable the IncludeLocalization setting to prevent the default localization strings from being loaded.
Handle the client-side ReportDesignerClientSideEventsBuilder.CustomizeLocalization (or WebDocumentViewerClientSideEventsBuilder.CustomizeLocalization) event.
In the event handler, use the argument’s LoadMessages method to load JSON files to a reporting component.
<script type="text/javascript" id="script">
function CustomizeLocalization(s, e) {
e.LoadMessages($.get('@Url.Content("/dx-analytics-core.xx.json")'));
e.LoadMessages($.get('@Url.Content("/dx-reporting.xx.json")'));
e.LoadMessages($.get('@Url.Content("/dx-rich.xx.json")'));
}
</script>
@(Html.DevExpress().ReportDesigner("reportDesigner")
.ClientSideModelSettings(x => x.IncludeLocalization = false)
.ClientSideEvents(x => x.CustomizeLocalization("CustomizeLocalization"))
.Height("1000px")
.Bind("Report"))
You can obtain DevExpress localized resources as described in the DevExpress UI Localization Service (Maintenance Mode) help topic, and use the ASP.NET Core framework standard localization technique. For more information, review the following Microsoft topic: Implement a strategy to select the language/culture for each request in a localized ASP.NET Core app.
The UI Localization Client is a cross-platform utility that helps you identify non-translated strings in DevExpress UI controls and translate them during a debug session. The utility generates RESX files with translated resources and adds them to the project. The UI Localization Client loads all Web Reporting resource strings after the controls are rendered and does not reflect later UI interactions.
For more information refer to the following topic: UI Localization Client.
The resource strings for the Web Reporting Controls (Web Document Viewer and Web Report Designer) are located in the following localization containers in the UI Localization Client window:
DevExpress.XtraReports.Web.Localization.LocalizationContainerContains localization strings specific only to the Web Reporting Controls.DevExpress.Utils.Localization.CoreLibraryResourcesContains cross-platform localization strings used in the Web Reporting Controls.DevExpress.Web.Resources.Localization.LocalizationContainerContains localization strings common to DevExpress Web Components used in the Web Reporting Controls.
The Report Designer enables you to localize a report for different target languages and cultures, and store localized values in the REPX file.
Run Demo: Localization Feature Tour
Perform the following actions to localize a report:
Specify a report language other than the Default:
Change controls property values. You can move and resize a control.
Save the report.
When you load a localized report, use the Language drop-down list to enable the localization mode and switch to the localized version.
The Localization Editor allows you to change text strings in the report and expedite the translation process.
You can also implement the ITranslationService interface to automatically translate all text strings displayed within the Localization Editor to a selected language.
Review the following help topic for more information: Localize Reports
Tip
If the Language drop-down list contains no languages other than Default, ensure the InvariantGlobalization option is set to false.
You can activate AI-powered Localization in your ASP.NET Core application. Refer to the following topic for more information: Localize Reports in the Web Report Designer.
After you register the extension, the Localize with AI button appears. Select a language from the Language drop-down and click the button to translate all localizable property values to the selected language:
You can adjust AI-translated strings in the Localization Editor.
Refer to the following topic for more information: Localize Reports in the Web Report Designer.