Localization - ASP.NET MVC Document Viewer
- 4 minutes to read
To localize the Web Document Viewer control, use the built-in localization mechanisms to replace localization strings. Load localization strings from JSON dictionary files or satellite resource assemblies.
Use JSON Dictionaries
Tip
The component UI is built on DevExtreme widgets. To localize editors and client-side formatting of dates and numbers (outside the generated document), use DevExtreme localization and call DevExpress.localization.locale(<Locale>). For more information, review the following topic: DevExtreme - Localization and Globalization Overview.
Obtain Dictionaries
You need to load three JSON dictionaries:
<Locale>.json. Contains localization strings for DevExtreme editors used in the Reporting component. The dictionaries are available on GitHub. For more information, see DevExtreme jQuery - Localization and Globalization Overview.dx-analytics-core.<Locale>.json. Contains core localization strings. This dictionary is included in a ZIP archive available from the DevExpress Localization Service. For more information, see DevExpress UI Localization Service (Maintenance Mode).dx-reporting.<Locale>.json. Contains Document Viewer-specific localization strings. This dictionary is included in a ZIP archive available from the DevExpress Localization Service. For more information, see DevExpress UI Localization Service (Maintenance Mode).
In the file names above, the <Locale> is the locale of the dictionary contents.
Use Dictionaries
To localize the application UI, you should do the following:
- Subscribe to the
CustomizeLocalizationevent and load thedx-analytics-core.<Locale>.jsonanddx-reporting.<Locale>.jsondictionaries using the LoadMessages(messages) method.
Use Satellite Resource Assemblies
You can localize the Web Document Viewer with the Satellite Resource Assemblies (libraries that contain translated resources).
For more information, review the following help topic: Localize ASP.NET MVC Extensions with Satellite Resource Assemblies.
Substitute Localization Strings
Use the UpdateLocalization method in the client-side ASPxClientWebDocumentViewer.CustomizeLocalization event handler to substitute a particular localization string with the specified text.
Tip
You can use the satellite resource assemblies to translate text strings and then adjust the translation by handling the CustomizeLocalization event.
@Html.DevExpress().WebDocumentViewer(settings => {
settings.Name = "WebDocumentViewer";
settings.ClientSideEvents.CustomizeLocalization = "function(s) { " +
"s.UpdateLocalization({" +
"'Search' : 'Suche'," +
"'Search result' : 'Suchergebnisse'," +
"'Next Page': 'Nächste Seite'," +
"'Export Options' : 'Exportoptionen'});}";
}).Bind(new DXWebApplication.XtraReport1()).GetHtml()
Important
Localization strings are case sensitive. A string is translated if you use correct case to specify it.
Localized string values may be capitalized differently on a web page. For example, the ‘Search result’ string is displayed as ‘SEARCH RESULT’.
To identify the localized string you want to change, locate the UI element in the browser’s Developer Tools, as shown in the following image:

The ‘SEARCH RESULT’ string in the screenshot above is the ASPxReportsStringId.WebDocumentViewer_SearchResultText field value.
Use UI Localization Client
The UI Localization Client is a cross-platform utility that allows you to identify non-translated strings of DevExpress UI controls and translate them during a debug session. The utility automatically generates a RESX file(s) with translated resources and adds it to the project. Note that the UI Localization Client loads all Web Reporting resource strings once the controls are rendered, without reflecting your interaction with the UI.
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.LocalizationContainer
- Contains localization strings specific only to the Web Reporting Controls.
- DevExpress.Utils.Localization.CoreLibraryResources
- Contains cross-platform localization strings used in the Web Reporting Controls.
- DevExpress.Web.Resources.Localization.LocalizationContainer
- Contains localization strings common to DevExpress Web Components used in the Web Reporting Controls.
Troubleshooting
If you followed the instructions in the UI Localization Client topic and the resource strings are still not visible, try clearing browser cache.
Identify Non-Translated Strings
- Use our UI Localization Client tool shipped as part of your DevExpress subscription. This tool streamlines the entire localization process. You can quickly find non-translated strings and translate them during a debug session.
- Handle the XtraLocalizer.QueryLocalizedStringNonTranslated event to collect non-localized resource strings for further translation. The event allows you to focus on strings that require translation in your application.