Creating a Multilingual RDL Report.

Creating a Multilingual RDL Report: A Step-by-Step Guide

ARUL RAJ
Bold Reports

--

Bold Reports is a powerful tool that allows you to create and deploy reports for your organization. One important aspect of creating reports is localizing them to different languages so that users can view data in their language. In this blog, we will discuss how to create a multilingual RDL report using Bold Reports and the Lookup function.

In this blog, I am using this report. This report has a simple table with three columns, bound to AdventureWorks sample MSSQL Server data. I will explain how to customize its header cells with multiple languages.

Step 1: Create a language parameter.

The first step in creating a multilingual RDL report is to create a language parameter. This parameter will allow users to select their preferred language when viewing the report. You can create a language parameter by following these steps:

  1. Open the report in the Bold Reports Standalone Report Designer.
  2. In the Design tab, select the parameters icon in the right-hand menu.
Parameter icon in Standalone Report Designer.
Parameters

3. Click + NEW PARAMETER to add a new parameter.
4. In the Parameter Name field, provide the value Language.
5. In the Prompt field, provide the value Select a language.
6. In the Data Type field, select String.

Defining Report Parameter in Standalone Report Designer.
Defining Report Parameter

7. Click on the Assign Values link in the Available Value field, and enter the language name and language codes for each language you want to support. For example, “en-US” for United States English, “fr-FR” for France French, and so on.

Adding Report parameter values in Standalone Report Designer.
Report parameter values

Step 2: Create a data set for localized text.

Once you have created the language parameter, you need to create a data set that contains the localized text for each language. This data set should have three columns: one for the language code, another for the localized text key, and the last one for the localized text. The following image shows the data source from my MSSQL Server.

Table of localized text from my MSSQL Server.
Table of localized text

You can create a data set in the Bold Reports Standalone Report Designer by following these steps:

  1. In the Standalone Report Designer, select the Data tab.
  2. Click the Dataset tab to create a new data set. Choose the database where the localized strings are stored. I am using the MSSQL Server as the database, so I select it.
  3. Provide the data set name. This name will be used in the Lookup function to retrieve data. I will explain this in a subtopic.
Create a data set in the Standalone Report Designer to retrieve localized text.
Create a data set to retrieve localized text

4. In the data designer, toggle to Code mode so that you can use the parameter values along with the query.
5. In the Query Designer, enter a query that selects the localized text and its corresponding key for each language. For example, you can use the following SQL query:

SELECT LocalizedText, LocalizedTextKey FROM LocalizedTextTable WHERE LanguageCode = @Language

In this query, replace “LocalizedTextTable” with the name of your table that contains the localized text, and “LanguageCode,” “LocalizedText,” and “LocalizedTextKey” with the names of your corresponding columns.

Code with report parameter.
Code with report parameter

6. Click Finish to save the multilingual data set.

Step 3: Use the Lookup function to display localized text.

To display the localized text in your report, you can use the Lookup function available in the Report Designer. The Lookup function is used to retrieve a value from a data set based on a specified key value. In our case, the key value is the localized text key selected by the user, and the data set contains the localized text for each language.
To use the Lookup function, follow these steps:

  1. Select the element in your report that you want to localize. In my example report, I am using a table. So, I select its first column header cell.
  2. In the Properties pane, find the Content field and click Expression to open the Expression Editor.
Adding an expression in Standalone Report Designer.
Adding an expression

3. In the Expression Editor, enter an expression like the following:

=Lookup("<Table header text>", Fields!LocalizedTextKey.Value, Fields!LocalizedText.Value, "LocalizedTextDataset")

Here are the sample Lookup expressions using static values:

=Lookup("Sales ID", Fields!LocalizedTextKey.Value, Fields!LocalizedText.Value, "LocalizedTextDataset") 
=Lookup("Order Quantity", Fields!LocalizedTextKey.Value, Fields!LocalizedText.Value, "LocalizedTextDataset")
=Lookup("Unit Price", Fields!LocalizedTextKey.Value, Fields!LocalizedText.Value, "LocalizedTextDataset")

In these expressions, replace “LocalizedTextDataset” with the name of your data set that contains the localized text for each language.

Expression with Lookup function.
Expression with Lookup function

4. Click OK to save the expression. That’s it! You have created a multilingual RDL report.

Step 4: Run the multilingual RDL report.

Click Preview in the Standalone Report Designer. You can see the option to select a language.

Multilingual RDL report with language parameter.
Multilingual RDL report with the language parameter

Select a language and click View Report. You can see the localized report.

Multilingual report displaying French text.
Multilingual report displaying French text

You can download this sample multilingual RDL report from here.

Conclusion

That’s it! In this blog, we have discussed how to create a multilingual RDL report using Bold Reports and the Lookup function. By following these simple steps, you can create reports that are accessible to users in different languages. To learn more about the Report Designer and its report items, look through our documentation. To experience the features live, check out our online demo.

If you have any questions, please post them in the comments section below. You can also contact us through our contact page, or if you already have an account, you can log in to ask your question.

Bold Reports offers a 15-day free trial without any credit card information required. We welcome you to start one and experience Bold Reports for yourself. Try it and let us know what you think!

Catch us on Twitter, Facebook, and LinkedIn for info about upcoming releases.

Originally published at https://www.boldreports.com on April 13, 2023.

--

--

ARUL RAJ
Bold Reports

Arulraj, Sr. Product Manager at Syncfusion, is passionate about technology and dedicated to helping individuals implement best coding practices.