Search results

Localization of Bold Report Viewer

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.

  1. Add Resources file for the different cultures.
  2. Assign the value to each culture using key.
  3. Assign a Current UI Culture to the application.
  4. Set Report Viewer properties.

Add Resources file for the different cultures

  1. Right-click the project and add the Resources folder in your application.

  2. Right-click on the Resources folder and add the new folder then name it asfr-FR.

  3. Right-click on the fr-FR folder and pressCtrl+Shift+A keys or select Add > New Item from the context menu.

  4. In the Add New Item dialog, select Resources file and name it as BoldReports.UWP.Resources.resw.

    Adding a new resource file

  5. Click Add.

In case, the another culture is used in the application, then create another folder in name [CultureInfo Code] under the Resources folder. For example, fr-FR and the naming convention needs to be followed mandatorily.

Assign the value to each culture using key

To assign Values in Resource, the resource file needs to be updated according to the following steps.

  1. Open the BoldReports.UWP.Resources.resw file by double clicking it from Solutions Explorer.

  2. Add the 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.

    Edit resource file

    you can download the modified resource file from here and replace it in your application.

Assign a Current UI Culture to the application

Mention the culture to be referred while initializing the application, so that application refer to the appropriate value provided in 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";
}

Set Report Viewer properties

  1. 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-detail report is used.

  2. Now, run the application and the below output shows the toolbar items localized fr-FR culture.

    Localization output