Multiple Resource Files in BIRT
Since BIRT 2.6 it is possible to define multiple resource files. This enables BIRT reports to have e.g. one file with overall labels/translations which will be used for all reports and other files which contain labels/translations which are specific for a particular report.
Example: Add additional resource file for the 'Services Catalog' Report
- Export the 'Service Catalog' report using the BIRT Report Customizer Dialog.
- Copy the report 'BIRT Report ServiceCatalog.rptdesign' into report project directory of the BIRT designer.
- Copy Valuemation translations directories (which contain entries necessary for the report) to report project directory
- Refresh report project in BIRT Designer
In the standard report, the resource for this report is CrystalReportsLabelsText. Note that the “_en_US.properties” part is omitted. This allows generating the report in the language which is selected in Valuemation. If you use the German version, the report will be generated using the German resource files.
- Change the report. Use the Add File button to add 'crystalreports/CrystalReportsLabelsText_en_US.properties'. Remove 'CrystalReportsLabelsText'.
- Let's assume that it is the company policy for all reports to contain a confidentiality remark.
This remark we want to save in an additional file containing such additional information: BIRT/BIRTReportsText_en_US.properties (Note: This is only for demonstration purposes, normally you would use the CrystalReportsLabelsText for this purpose) - Using the Valuemation Rich client, add the following entries in the 'Translation for Application Text' catalog:
- Basename: BIRT/BIRTReportsText
- Language: English
- Key: ServiceCatalog.confidential
- Standard Translation: The content of this report is confidential!
- Basename: BIRT/BIRTReportsText
- Language: German
- Key: ServiceCatalog.confidential
- Standard Translation: Der Inhalt dieses Reports ist vertraulich!
- Restart Valuemation Rich Client.
- Copy the BIRT directory of the Valuemation Rich Client translation cache to the BIRT project directory.
- Refresh BIRT Project in the designer.
- Add the BIRT/BIRTReportsText_en_US.properties as an additional resource file.
- In the report, add an additional row in the grid below 'Service Catalog'.
- Add a label, select the localization tab for the label.
- Select textkey 'ServiceCatalog.confidential'
- Change Color 'Red' and set the font style to Bold on the 'General' properties tab.
- Save the report.
- In order to use multiple languages in Valuemation, you have to remove the '_en_US' part in the report design file. To do this, switch to the XML Source tab:
- Import the report into Valuemation.
- In the web.xml of the BIRT Report Server, set the BIRT_RESOURCE_FOLDER parameter to blank
- Restart the BIRT Report Server.
The new Report in English:
If you switch the language in Valuemation to German and start the 'Print to BIRT' action again, a report in German will be generated:
|