Localization of Bold Report Viewer allows you to localize the static text such as tooltip, parameter block, and dialog text based on a specific culture. Refer the following steps to localize the Report Viewer based on the culture.
Right-click the project and add the Resources
folder in your application.
Right-click on the Resources
folder and pressCtrl+Shift+A
keys or select Add > New Item from the context menu.
In the Add New Item dialog, select Resources file and name it as BoldReports.Wpf.resx
.
Click Add.
Set the Build Action
to Embedded resource and Custom Tool
to ResXFileCodeGenerator
.
If another culture is used in the application, create another resource file named
[AssemblyName].[CultureInfo Code].resx
, following the mandatory naming convention. For example, if you are creating a resource for thefr-FR
culture, you should create a new resource file namedBoldReports.Wpf.fr-FR.resx
and manually translate its content.
To assign Values
in Resource, the resource file needs to be updated according to the following steps.
Open the BoldReports.Wpf.resx
file by double clicking it from Solutions Explorer.
Add the resource key name, and its corresponding localized value by editing its field. Modify the resource values based on the fr-FR
culture as shown in the following image.
You can download the modified resource file from here and replace it in your application.
Mention the culture to be referred while initializing the application, so that application refer to the appropriate value provided in resource file.
Set the CultureInformation
in the application before the InitializeComponent()
method call. In this application, MainWindow.xaml.cs
is the startup page and culture is assigned as like below.
public MainWindow()
{
System.Globalization.CultureInfo.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");
InitializeComponent();
}
Add the Report Viewer initialization code.
this.reportViewer.ReportPath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\sales-order-detail.rdl");
this.reportViewer.RefreshReport();
In this tutorial,
sales-oreder-detail
report is used.
Now, run the application and the below output shows the toolbar items localized fr-FR
culture.