Localization in ASP.NET Core Application
- 3 minutes to read
You can localize the user interface of the Document Viewer and Web End-User Report Designer, and use the Report Designer to localize the reports.
Localize the User Interface
Obtain JSON Files from the Localization Service
Log into the DevExpress website.
Open the DevExpress Localization Service.
Select your target language, modify translations, and click the Download button. Refer to the Localization Service documentation topic for detailed information.
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):
Load JSON Files in a Razor-Based Application
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.
Copy the dx-analytics-core.xx.json and dx-reporting.xx.json files (where xx is the language identifier) to the application directory (for instance, wwwroot).
Open the View file and disable the ReportDesignerClientSideModelSettings.IncludeLocalization (or WebDocumentViewerClientSideModelSettings.IncludeLocalization) option not to load the default localization strings.
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.
The Report Designer enables you to localize a report for different target languages and cultures and store localized values in the REPX file.
Review the online demo Localization Feature Tour
Use Properties Panel
Perform the following actions to localize a report:
Specify a report language other than the Default:
The Language drop-down list contains all available .NET locales. The report's languages are highlighted in bold.
Change the controls' property values. You can move and resize a control.
When the report's language is set to any language other than the Default language (localization mode), the Property Grid shows only localizable properties. The localization mode does not allow you to add a new control from the Toolbar or use the Report Wizard.
Save the report.
When you load a localized report, use the Language drop-down list to enable localization mode and switch to the localized version.
Use Localization Editor
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 the selected language.
Review the Localize Reports article for more information.