All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Localize Reports

  • 5 minutes to read

Overview

This document describes how to localize a report that targets different languages and cultures.

This method uses localized strings serialized with the report layout. You can call the XtraReport.SaveLayout method to save localized strings in REPX format with the report's layout.

NOTE

This method is the default for reports in v20.1 or later. Previous versions use satellite assemblies.

TIP

Review the Vehicle Inspection Report WinForms demo to see the localized report.

A localized report can display text based on different cultures. The following text properties can be localized:

TIP

To display translated text in a localized report, adjust the following attributes of your reports and individual report controls:

  • visibility
  • size
  • location
  • value formatting
  • margins
  • paper kind

How to Localize a Report

To localize a report, open it in the Report Designer and specify a report language other than Default. Change the text, size, and location of reporting controls and save the report. All language-specific changes are saved with the report. When a Document Viewer loads a localized report, the document contains modifications that match the application's culture.

To localize a report, follow the steps below:

  1. Use the Property Grid to set the report's Language property to a value other than Default.

  2. To display only localizable properties in the Property Grid, click the Localizable Properties toolbar button in the Property Window as demonstrated in the picture below.

  3. Change the control's localizable property values. You can move and resize a control.

  4. Save the report.

You can use the Localization Editor to change text in the report and expedite the translation process.

Quick Access to Localized Versions

To determine whether a report contains localized settings, or to access the localized version, use the Localization -> Language drop-down list.

How to Preview a Report in the Specified Locale

The Report Designer always loads a report in the Default language. You can change the language in the Localization Editor or set the report's language as described in the previous section. Then, switch to the Preview tab to view the localized document.

To preview a localized report in your application, use one of the following methods:

  1. Specify the report's culture. The method depends on the application platform:

    All Platforms

    Call the XtraReport.ApplyLocalization method before the XtraReport.CreateDocument method. You can also handle the report's BeforePrint event and call the XtraReport.ApplyLocalization method in the event handler.

    The language parameter in the ApplyLocalization method has a priority over the current thread's culture.

    WinForms

    If you do not call the XtraReport.ApplyLocalization method, specify the culture of the current thread prior to document creation. For this, use the static Thread.CurrentThread.CurrentCulture property. The report creates a document in the current thread's culture. The Thread.CurrentThread.CurrentUICulture property allows you to set the Document Viewer UI language.

    Refer to the
    WinForms Application: Select a Culture Different from the System Culture document for more information.

    ASP.NET MVC and Web Forms

    If you do not call the XtraReport.ApplyLocalization method, specify the culture of the current thread prior to document creation. ASP.NET MVC and Web Forms applications can use methods described in Microsoft's Globalization, Internationalization and Localization section.

    ASP.NET MVC and Web Forms applications can also implement a custom IGlobalizationService interface and register a service to specify the current thread locale. This method applies to requests processed by DevExpress HTTP handlers.

    ASP.NET Core

    If you do not call the XtraReport.ApplyLocalization method, specify the culture of the current thread prior to document creation. Review the Globalization and localization in ASP.NET Core topic for more information.

    WPF

    If you do not call the XtraReport.ApplyLocalization method, specify the culture of the current thread prior to document creation. Use the static Thread.CurrentThread.CurrentCulture property to set a report's culture. The static Thread.CurrentThread.CurrentUICulture property allows you to set the Document Viewer UI language. Refer to the
    WPF Application: Select a Culture Different from the System Culture document for more information.

    TIP

    You can set different languages to the Viewer UI and the report displayed in the Viewer. Handle the report's BeforePrint event and call the XtraReport.ApplyLocalization method that allows you to specify a culture and localize a report.

  2. Invoke a preview window or use a Document Viewer control to load a localized report. Refer to the following topics for more information:

Localizable Properties

A localized report contains localization items - objects that combine the control, language, property and value. If a value does not relate to any language, it is attributed to a default language. Localization items are contained in the XtraReport.LocalizationItems collection.

Localizable properties are annotated with the DevExpress.XtraReports.Localization.XRLocalizableAttribute custom attribute:

[XRLocalizable(true)]

The following properties are localizable: