Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 68 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,84 +5,122 @@
[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives)
<!-- default badges end -->

# DevExpress VCL Reports — Localize the DevExpress Report Viewer and Report Designer
# DevExpress Reports for Delphi/C++Builder — Localize the Report Viewer and Report Designer

This example localizes DevExpress VCL Reports components.

The [DevExpress Reporting Platform](https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports) fully supports UI localization.
The localization example in this repository allows users to select between English (default) and German (localized) versions of two built-in DevExpress dialogs:
[Report Viewer](https://docs.devexpress.com/XtraReports/401850/web-reporting/web-document-viewer) and
[Report Designer](https://docs.devexpress.com/XtraReports/119176/web-reporting/web-end-user-report-designer).
The [DevExpress Reports for Delphi/C++Builder][vcl-reports-intro] fully support UI localization.
The localization example in this repository allows users to select between English (default) and German (localized) versions
of two built-in DevExpress dialogs: [Report Designer][dx-report-designer] and [Report Viewer][dx-report-viewer].
The example includes projects for both [Delphi](./Delphi) and [C++Builder](./CPB).

<img width="450" src="./images/Lokalisierungsbeispiel.png"
> <img width="450" src="./images/Lokalisierungsbeispiel.png"
alt="Start screen of the localization example, allowing users to select between English and German,
and to display Report Designer and Report Viewer dialogs" />

## Prerequisites

See the [DevExpress Reports Prerequisites](
https://docs.devexpress.com/VCL/405773/ExpressCrossPlatformLibrary/vcl-backend/reports-dashboards-app-deployment#vcl-reportsdashboards-prerequisites).
[DevExpress Reports Prerequisites][req]

[req]: https://docs.devexpress.com/VCL/405773/ExpressCrossPlatformLibrary/vcl-backend/reports-dashboards-app-deployment#vcl-reportsdashboards-prerequisites

## Implementation Details

To localize the DevExpress Report Designer and Report Viewer in your Delphi or C++Builder application,
you must:

1. Use the [DevExpress UI Localization Service](https://docs.devexpress.com/GeneralInformation/16235/localization/localization-service)
1. Use the [DevExpress UI Localization Service][localization-service]
to obtain localization files for DevExpress VCL Report Viewer and Designer.
These files contain UI string translations for specific languages/locales.
Refer to the following guide to learn more:
[Localize Core Reporting Components: Use JSON Files](https://docs.devexpress.com/XtraReports/400932/web-reporting/common-features/localization/localization-in-asp-net-core-reporting-applications#use-json-files).
1. Extract downloaded files to a `Localization` folder next to your compiled application executable.
[Localize Core Reporting Components: Use JSON Files][l10n-json-files].
1. Extract downloaded files to a [localization] folder next to your compiled application executable.
Note that projects in this repository output their executables to the same location.
This allows both projects to use the same localization files.
1. Assign a language identifier (also known as [locale][1] or [culture identifier][2]) to the
[`TdxReport.Language`](https://docs.devexpress.com/VCL/dxReport.TdxReport.Language)
1. Assign a language identifier (also known as [locale][locale] or [culture identifier][culture]) to the
[TdxReport.Language]
property to switch the Report Designer/Report Viewer to the desired language:

**Delphi:**
<!-- start-code-block -->
#### Delphi
```delphi
dxReport1: TdxReport;

// Switch Report UI to German
dxReport1.Language := 'de-DE'
```

**C++Builder:**
```cpp
#### C++Builder
```c
TdxReport *dxReport1;

// Switch Report UI to German
dxReport1->Language = "de-DE";
```

[1]: https://learn.microsoft.com/en-us/globalization/reference/glossary#locale
[2]: https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-globalization-cultureinfo#culture-names-and-identifiers
<!-- end-code-block -->

For a step-by-step guide, refer to the following help topic:
[Report Viewer and Designer UI Localization](https://docs.devexpress.com/VCL/405598/ExpressReports/localization/vcl-report-viewer-and-designer-localization).
[Report Viewer and Designer UI Localization][viewer-designer-l10n].

This example does not localize report content.
To localize report content in your project, refer to the following guide: [Report Localization](https://docs.devexpress.com/VCL/405599/ExpressReports/localization/vcl-report-localization).
To localize report content in your project, refer to the following guide: [Report Content Localization][report-content-l10n].

The localization mechanism described in this example applies only to the DevExpress Report Designer and Report Viewer.
Other DevExpress VCL components support localization using [resource files and the Localizer Editor](https://docs.devexpress.com/VCL/154039/ExpressCrossPlatformLibrary/how-to/localize-an-application).
Other DevExpress VCL components support localization using [resource files and the Localizer Editor][localize-an-application].


## Files to Review

- [`Delphi/uMainForm.pas`](./Delphi/uMainForm.pas) loads an example report from `ExampleReport.repx`.
Event handlers assigned to [`TcxRadioButton`](https://docs.devexpress.com/VCL/cxRadioGroup.TcxRadioButton)
- [uMainForm.pas] (Delphi) and [uMainForm.cpp] (C++Builder) load an example report from [ExampleReport.repx].
Event handlers assigned to [TcxRadioButton]
components switch localization language between English and German.
- [`Localization/*.de.json`](./Localization/) files contain localized UI strings.
- [localization/*.de.json][localization] files contain localized UI strings.

## Documentation

- [VCL Report Viewer and Designer UI Localization](https://docs.devexpress.com/VCL/405598/ExpressReports/localization/vcl-report-viewer-and-designer-localization)
- [VCL Reports Localization](https://docs.devexpress.com/VCL/405597/ExpressReports/vcl-reports-localization)
- [DevExpress UI Localization Service](https://docs.devexpress.com/GeneralInformation/16235/localization/localization-service)
- [TdxReport.Language Property](https://docs.devexpress.com/VCL/dxReport.TdxReport.Language)
- [ExpressReports Application Deployment Requirements](https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports#expressreports-app-deployment)
- [VCL Report Viewer and Designer UI Localization][viewer-designer-l10n]
- [VCL Reports Localization][reports-l10n]
- [DevExpress UI Localization Service][l10n-service]
- [ExpressReports Application Deployment Requirements][req]
- API reference:
- [TdxReport](https://docs.devexpress.com/VCL/dxReport.TdxReport)
- [TdxReport.Layout](https://docs.devexpress.com/VCL/dxReport.TdxReport.Layout)
- [TdxReport.Language]

<!-- documentation links -->
[vcl-reports-intro]: https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports
[dx-report-viewer]: https://docs.devexpress.com/XtraReports/401850/web-reporting/web-document-viewer
[dx-report-designer]: https://docs.devexpress.com/XtraReports/119176/web-reporting/web-end-user-report-designer
[reports-l10n]: https://docs.devexpress.com/VCL/405597/ExpressReports/vcl-reports-localization
[report-content-l10n]: https://docs.devexpress.com/VCL/405599/ExpressReports/localization/vcl-report-localization
[viewer-designer-l10n]: https://docs.devexpress.com/VCL/405598/ExpressReports/localization/vcl-report-viewer-and-designer-localization
[l10n-service]: https://docs.devexpress.com/GeneralInformation/16235/localization/localization-service
[l10n-json-files]: https://docs.devexpress.com/XtraReports/400932/web-reporting/common-features/localization/localization-in-asp-net-core-reporting-applications#use-json-files
[localize-an-application]: https://docs.devexpress.com/VCL/154039/ExpressCrossPlatformLibrary/how-to/localize-an-application

<!-- reference links -->
[TdxReport.Language]: https://docs.devexpress.com/VCL/dxReport.TdxReport.Language
[TcxRadioButton]: https://docs.devexpress.com/VCL/cxRadioGroup.TcxRadioButton

<!-- external documentation links -->
[locale]: https://learn.microsoft.com/en-us/globalization/reference/glossary#locale
[culture]: https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-globalization-cultureinfo#culture-names-and-identifiers

<!-- in-repository links -->
[localization]: ./localization/
[uMainForm.pas]: ./Delphi/uMainForm.pas
[uMainForm.cpp]: ./CPB/uMainForm.cpp
[ExampleReport.repx]: ./ExampleReport.repx


## More Examples

- [Store Report Layouts in REPX Files][file-example]
- [Store Report Layouts in a Database][database-example]

[file-example]: https://github.com/DevExpress-Examples/vcl-reports-store-layout-template-file
[database-example]: https://github.com/DevExpress-Examples/vcl-reports-store-layout-template-database


## Localized Report Dialogs Preview

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.