This chapter shows how to incorporate internationalization while using the report designer. This allows the report designer to specify labels in the report template that will be substituted during report generation with values from the language appropriate properties file.
Externalize Label Strings
The first step is to externalize the strings required for the report. This is done by creating a properties file with the value of each property being the text you want to appear in the report. The name of each property will be used in the report definition.
...
Code Block |
---|
report.title=Sample Product Inventory Report label.1=Product Code label.2=Product Name label.3=Quantity |
Define the Resource Path
The report template needs to know where it will be able to find the properties files that will be used as a resource for localized strings.
...
In the Properties pane, specify the directory in which the MyReport.properties file was saved.
Add Resource Labels
The resource labels defined on the report will look in the resource files (in the report's resource path) when the report is generated. The resource key of the resource label is the property name for this lookup.
...
Again, click on the Preview button to see that the system found and substituted the proper labels.
Create Localized Resource Files
If the report needs to be translated to different languages, more resource files (properties files) need to be created - one per language.
...