Skip to content
Draft
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
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,9 @@ __recovery/
*.identcache

# Build output directories
Win32/Debug/
Win32/Release/
Win64/Debug/
Win64/Release/
Win64x/Debug/
Win64x/Release/
Win32/
Win64/
Win64x/

# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
*.stat
Expand Down
173 changes: 60 additions & 113 deletions Delphi/uMainForm.dfm
Original file line number Diff line number Diff line change
@@ -1,135 +1,82 @@
object MainForm: TMainForm
Left = 0
Top = 0
Caption = 'MainForm'
ClientHeight = 483
ClientWidth = 606
BorderIcons = [biSystemMenu, biMinimize, biHelp]
BorderStyle = bsSingle
Caption = 'DevExpress Reports Localization Example'
ClientHeight = 111
ClientWidth = 411
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
OnCreate = FormCreate
TextHeight = 15
object btnShowDesigner: TcxButton
Left = 24
Top = 32
Width = 145
Height = 25
Caption = 'Show Designer'
TabOrder = 0
OnClick = btnShowDesignerClick
end
object btnViewReport: TcxButton
Left = 192
Top = 32
Width = 193
Height = 25
Caption = 'View Report'
object btnGroupDisplayDialog: TcxGroupBox
Left = 211
Top = 17
Caption = 'Display a Localized Report Dialog:'
TabOrder = 1
OnClick = btnViewReportClick
end
object cxGrid1: TcxGrid
Left = 24
Top = 176
Width = 521
Height = 265
TabOrder = 2
object gvCategories: TcxGridDBTableView
DataController.DataSource = DataModule1.dsCategories
DataController.KeyFieldNames = 'CategoryID'
object gvCategoriesCategoryID: TcxGridDBColumn
DataBinding.FieldName = 'CategoryID'
end
object gvCategoriesCategoryName: TcxGridDBColumn
DataBinding.FieldName = 'CategoryName'
end
object gvCategoriesDescription: TcxGridDBColumn
DataBinding.FieldName = 'Description'
end
end
object gvProducts: TcxGridDBTableView
DataController.DataSource = DataModule1.dsProducts
DataController.DetailKeyFieldNames = 'CategoryID'
DataController.KeyFieldNames = 'ProductID'
DataController.MasterKeyFieldNames = 'CategoryID'
object gvProductsProductID: TcxGridDBColumn
DataBinding.FieldName = 'ProductID'
end
object gvProductsProductName: TcxGridDBColumn
DataBinding.FieldName = 'ProductName'
Width = 244
end
object gvProductsSupplierID: TcxGridDBColumn
DataBinding.FieldName = 'SupplierID'
end
object gvProductsCategoryID: TcxGridDBColumn
DataBinding.FieldName = 'CategoryID'
end
object gvProductsQuantityPerUnit: TcxGridDBColumn
DataBinding.FieldName = 'QuantityPerUnit'
Width = 124
end
object gvProductsUnitPrice: TcxGridDBColumn
DataBinding.FieldName = 'UnitPrice'
end
object gvProductsUnitsInStock: TcxGridDBColumn
DataBinding.FieldName = 'UnitsInStock'
end
object gvProductsUnitsOnOrder: TcxGridDBColumn
DataBinding.FieldName = 'UnitsOnOrder'
end
object gvProductsReorderLevel: TcxGridDBColumn
DataBinding.FieldName = 'ReorderLevel'
end
object gvProductsDiscontinued: TcxGridDBColumn
DataBinding.FieldName = 'Discontinued'
Width = 34
end
object gvProductsEAN13: TcxGridDBColumn
DataBinding.FieldName = 'EAN13'
Width = 76
end
Height = 86
Width = 192
object btnDisplayReport: TcxButton
Left = 15
Top = 52
Width = 145
Height = 25
Caption = 'Report Viewer'
TabOrder = 1
OnClick = btnDisplayReportClick
end
object cxGrid1Level1: TcxGridLevel
GridView = gvCategories
object cxGrid1Level2: TcxGridLevel
GridView = gvProducts
end
object btnDisplayDesigner: TcxButton
Left = 15
Top = 21
Width = 145
Height = 25
Caption = 'Report Designer'
TabOrder = 0
OnClick = btnDisplayDesignerClick
end
end
object btnSetLanguageUS: TcxButton
Left = 72
Top = 88
Width = 121
Height = 25
Caption = 'English'
TabOrder = 3
OnClick = btnSetLanguageUSClick
end
object btnSetLanguageDE: TcxButton
Left = 199
Top = 88
Width = 131
Height = 25
Caption = 'German'
TabOrder = 4
OnClick = btnSetLanguageDEClick
end
object lblSelectLanguage: TcxLabel
Left = 56
Top = 64
Caption = 'Select Language'
TabOrder = 5
object rbtnGroupLocalization: TcxRadioGroup
Left = 8
Top = 17
Caption = 'Localize Report Dialogs in:'
Properties.Items = <>
TabOrder = 0
Height = 86
Width = 185
object rbtnSelectEnglishLocalization: TcxRadioButton
Left = 16
Top = 25
Width = 113
Height = 17
Caption = 'English (en-US)'
TabOrder = 0
OnClick = rbtnSelectEnglishLocalizationClick
end
object rbtnSelectGermanLocalization: TcxRadioButton
Left = 16
Top = 56
Width = 113
Height = 17
Caption = 'German (de-DE)'
Checked = True
TabOrder = 1
TabStop = True
OnClick = rbtnSelectGermanLocalizationClick
end
end
object dxReport1: TdxReport
Parameters = <>
Left = 48
Top = 128
Left = 416
Top = 32
end
object dxBackendDataConnectionManager1: TdxBackendDataConnectionManager
Left = 112
Top = 128
Left = 472
Top = 32
object dxBackendDataConnectionManager1dxBackendDataSetJSONConnection1: TdxBackendDataSetJSONConnection
DisplayName = 'DataSetConnection'
object itmProducts: TdxBackendDataSetCollectionItem
Expand Down
67 changes: 30 additions & 37 deletions Delphi/uMainForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,26 @@ interface
cxGridTableView, cxGridDBTableView, cxGrid, FireDAC.Comp.DataSet,
FireDAC.Comp.Client, dxBackend.ConnectionString.JSON.DataSet,
dxBackend.ConnectionString.JSON, Vcl.StdCtrls, dxmdaset, uData, cxContainer,
cxLabel;
cxLabel, cxRadioGroup, cxGroupBox;

type
TMainForm = class(TForm)
dxReport1: TdxReport;
dxBackendDataConnectionManager1: TdxBackendDataConnectionManager;
btnShowDesigner: TcxButton;
btnViewReport: TcxButton;
btnDisplayDesigner: TcxButton;
btnDisplayReport: TcxButton;
dxBackendDataConnectionManager1dxBackendDataSetJSONConnection1: TdxBackendDataSetJSONConnection;
itmProducts: TdxBackendDataSetCollectionItem;
itmCategories: TdxBackendDataSetCollectionItem;
cxGrid1: TcxGrid;
gvCategories: TcxGridDBTableView;
gvCategoriesCategoryID: TcxGridDBColumn;
gvCategoriesCategoryName: TcxGridDBColumn;
gvCategoriesDescription: TcxGridDBColumn;
gvProducts: TcxGridDBTableView;
gvProductsProductID: TcxGridDBColumn;
gvProductsProductName: TcxGridDBColumn;
gvProductsSupplierID: TcxGridDBColumn;
gvProductsCategoryID: TcxGridDBColumn;
gvProductsQuantityPerUnit: TcxGridDBColumn;
gvProductsUnitPrice: TcxGridDBColumn;
gvProductsUnitsInStock: TcxGridDBColumn;
gvProductsUnitsOnOrder: TcxGridDBColumn;
gvProductsReorderLevel: TcxGridDBColumn;
gvProductsDiscontinued: TcxGridDBColumn;
gvProductsEAN13: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
cxGrid1Level2: TcxGridLevel;
btnSetLanguageUS: TcxButton;
btnSetLanguageDE: TcxButton;
lblSelectLanguage: TcxLabel;
procedure btnShowDesignerClick(Sender: TObject);
procedure btnViewReportClick(Sender: TObject);
procedure btnSetLanguageUSClick(Sender: TObject);
procedure btnSetLanguageDEClick(Sender: TObject);
rbtnGroupLocalization: TcxRadioGroup;
rbtnSelectEnglishLocalization: TcxRadioButton;
rbtnSelectGermanLocalization: TcxRadioButton;
btnGroupDisplayDialog: TcxGroupBox;
procedure FormCreate(Sender: TObject);
procedure btnDisplayDesignerClick(Sender: TObject);
procedure btnDisplayReportClick(Sender: TObject);
procedure rbtnSelectEnglishLocalizationClick(Sender: TObject);
procedure rbtnSelectGermanLocalizationClick(Sender: TObject);
private
{ Private declarations }
public
Expand All @@ -62,24 +45,34 @@ implementation

{$R *.dfm}

procedure TMainForm.btnSetLanguageDEClick(Sender: TObject);
procedure TMainForm.FormCreate(Sender: TObject);
begin
dxReport1.Language := 'de-DE'
// Switch to German localization when the application starts
dxReport1.Language := 'de-DE';
end;

procedure TMainForm.btnSetLanguageUSClick(Sender: TObject);
procedure TMainForm.btnDisplayDesignerClick(Sender: TObject);
begin
dxReport1.Language := 'en-US'
// Display the DevExpress Report Designer dialog
dxReport1.ShowDesigner;
end;

procedure TMainForm.btnShowDesignerClick(Sender: TObject);
procedure TMainForm.btnDisplayReportClick(Sender: TObject);
begin
dxReport1.ShowDesigner;
// Display the DevExpress Report Viewer dialog
dxReport1.ShowViewer;
end;

procedure TMainForm.btnViewReportClick(Sender: TObject);
procedure TMainForm.rbtnSelectEnglishLocalizationClick(Sender: TObject);
begin
dxReport1.ShowViewer;
// Switch to English localization
dxReport1.Language := 'en-US';
end;

procedure TMainForm.rbtnSelectGermanLocalizationClick(Sender: TObject);
begin
// Switch to German localization
dxReport1.Language := 'de-DE';
end;

end.
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
<!-- default badges list -->
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/1048527919/25.2.3%2B)
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T1305951)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183/help-resources/devexpress-code-examples)
[![](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

This example localizes DevExpress VCL [Report Viewer](https://docs.devexpress.com/XtraReports/401850/web-reporting/web-document-viewer)/[Report Designer](https://docs.devexpress.com/XtraReports/119176/web-reporting/web-end-user-report-designer) dialogs ([TdxReport](https://docs.devexpress.com/VCL/dxReport.TdxReport) component). German UI localization strings are stored within the project's [Localization](https://github.com/DevExpress-Examples/vcl-reports-localize/tree/25.1.4%2B/Localization) folder as JSON files. You can download UI localizations for additional languages from the [DevExpress Localization Service](https://localization.devexpress.com/).
# DevExpress VCL Reports
## Localize the DevExpress Report Viewer and Report Designer

<img width="1049" height="697" alt="vcl-reports-tdxreport-report-viewer-localization" src="https://github.com/user-attachments/assets/8e2366ae-501e-4b53-a8d9-865ba7155a2c" />
This example demonstrates how to localize DevExpress VCL Reports components in Delphi and C++ Builder projects.

## Overview

This example adds German localization for DevExpress VCL 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).
Both dialogs are parts of the [DevExpress Reporting Platform](https://docs.devexpress.com/VCL/405469/ExpressReports/vcl-reports),
which has full support for UI localization.

Study and build an example project in your preferred development environment:

- [Delphi](./Delphi)
- [C++ Builder](./CPB)

The strings for the German (`de_DE`) locale are stored in the [`./Localization/*.de.json`](./Localization) files.
You can use the [DevExpress Localization Service](https://localization.devexpress.com/) to download localization files for
German and multiple other locales.

## Documentation

Expand All @@ -17,6 +34,10 @@ This example localizes DevExpress VCL [Report Viewer](https://docs.devexpress.co
* [DevExpress UI Localization Service](https://docs.devexpress.com/GeneralInformation/16235/localization/localization-service)
* [TdxReport.Language Property](https://docs.devexpress.com/VCL/dxReport.TdxReport.Language)

---

<img width="1049" height="697" alt="vcl-reports-tdxreport-report-viewer-localization" src="https://github.com/user-attachments/assets/8e2366ae-501e-4b53-a8d9-865ba7155a2c" />

<!-- feedback -->
## Does this example address your development requirements/objectives?

Expand Down