Wednesday, June 24, 2009

BIRT report - database resource localization

I just thought of explaining how to display the localized resources from database. Basically, we create a mapping between the data in a column and the resource key in the resource bundle.

1. Add resource bundle to your report.
In the Layout tab, click anywhere on the blank space. Go to Resources tab. Select your resource bundle file.

2. Select the table where you contains the columns from your dataset. Go to the "Map" tab. Create a new mapping by clicking on the "Add" button.

3. Click on the "..." button to choose the property key from the resource bundle. The screenshot is given below.

When the column "city" in the dataset contains the value "Nantes", retrieve the value from the resource bundle whoose property key is dblocalization.prop1. This will instruct the report engine to display "LocalizedValue1" when it encounters "Nantes" in the dataset.

This should be done for all the values that you expect to be localized and shown in the report.

4. All set. Preview the report.

It would have been nicer if there is a only one mapping needed to values in the column and the resource bundle file name. Lets wait BIRT's upcoming features..

No comments:

Post a Comment