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:
- Open the report in the Bold Reports Standalone Report Designer.
- In the Design tab, select the parameters icon in the right-hand menu.
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.
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.
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.
You can create a data set in the Bold Reports Standalone Report Designer by following these steps:
- In the Standalone Report Designer, select the Data tab.
- 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.
- Provide the data set name. This name will be used in the Lookup function to retrieve data. I will explain this in a subtopic.
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.
- 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:
- 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.
- In the Properties pane, find the Content field and click Expression to open the Expression Editor.
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.
- 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.
Select a language and click View Report. You can see the localized report.
You can download this sample multilingual RDL report from here.
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.
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!