Skip to main content
A newer version of this page is available. .

Localization - ASP.NET MVC Document Viewer

  • 2 minutes to read

To localize the Web Document Viewer, use the built-in localization mechanisms and substitute localization strings to change the localization.

You can use any approach described below or both approaches simultaneously.

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 LoadMessages method to load JSON files for ‘xx’ language, obtained from Localization Service:

<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")'));
    }
</script>

@Html.DevExpress().WebDocumentViewer(settings => {
    settings.Name = "WebDocumentViewer1";
    settings.ClientSideEvents.CustomizeLocalization = "customizeLocalization";
}).Bind("TestReport").GetHtml()

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.

On a web page localized string values may be capitalized in a different manner. E.g. the ‘Search result’ string is displayed as ‘SEARCH RESULT’.

To determine the localized string whose value you wish to change, look for the UI element with the browser’s Developer Tools, as illustrated in the following picture:

web-viewer-localization-browser-inspect

The ‘SEARCH RESULT’ string in the screenshot above is the ASPxReportsStringId.WebDocumentViewer_SearchResultText field value.