Localization of Bold Reports® UWP Report Viewer
To localize the Bold Reports® UWP Report Viewer for a specific culture, add resource files for the culture and set the application UI culture. Localization renders static text such as tooltips, the parameter block, and dialog text in that culture. Follow these steps to localize the Report Viewer:
- Add Resources file for the different cultures.
- Assign the value to each culture using key.
- Assign a Current UI Culture to the application.
- Set Report Viewer properties.
How do I add resource files for different cultures?
To add resource files for different cultures in the UWP Report Viewer, create a culture folder under the Resources folder and add a resource file to it.
-
Right-click the project and add the
Resourcesfolder in your application. -
Right-click on the
Resourcesfolder and add the new folder then name it asfr-FR. -
Right-click on the
fr-FRfolder and pressCtrl+Shift+Akeys or select Add > New Item from the context menu. -
In the Add New Item dialog, select Resources file and name it as
BoldReports.UWP.Resources.resw.
-
Click Add.
In case, the another culture is used in the application, then create another folder in name
[CultureInfo Code]under theResourcesfolder. For example,fr-FRand the naming convention needs to be followed mandatorily.
How do I assign values to each culture?
To assign Values for a culture in the UWP Report Viewer, update the resource file according to the following steps:
-
Open the
BoldReports.UWP.Resources.reswfile by double clicking it from Solutions Explorer. -
Add the key, Name, and its corresponding localized value by editing its field. Modify the resource values based on the
fr-FRculture as shown in the following image:
you can download the modified resource file and replace it in your application.
How do I assign the current UI culture to the application?
To make the UWP Report Viewer use the localized values, mention the culture while initializing the application, so that the application refers to the appropriate value in the resource file.
Report Viewer application culture can be changed by setting the PrimaryLanguageOverride in the MainPage() constructor. In this application, MainPage.xaml.cs is the startup page and culture is assigned as like below:
public MainPage()
{
this.InitializeComponent();
ApplicationLanguages.PrimaryLanguageOverride = "fr-FR";
}How do I display the localized Report Viewer?
To render the localized UWP Report Viewer, set the Report Viewer initialization properties and run the application.
-
Add the Report Viewer initialization code.
this.ReportViewer.ReportServiceURL = @"https://demos.boldreports.com/services/api/ReportViewer"; this.ReportViewer.ReportPath = "~/Resources/docs/sales-order-dtail.rdl"; this.ReportViewer.RefreshReport();In this tutorial,
sales-oreder-detailreport is used. -
Now, run the application and the following output shows the toolbar items localized
fr-FRculture.