Jaspersoft BI Tools

iReport,Jaspersoft Design Studio,Jaspersoft Server, Schema Workbench,Analysis,Dashboards, Self Service BI, Domains,Topics,Ad-Hoc Reports, Jaspersoft ETL, Embedding BI,HTML-5 charts, Fusion Charts,JFree Charts,Drill down reports , Drill down Dashboards,Visualize.js, Performance Tuning, D3 Charts, Jaspersoft Customization

Monday, September 30, 2013

localization of jasper reports OR Internationalization of jasper reports - Hello world example

Hi.. small work out but very use full..
Generally customers want to see data in their own language.

This example is developed using iReport 5.1.0 pro, Jasper server pro and foodmart db with postgresql.

Sources/References :
Example : Converting English to Spanish
1) From Jasper Community

2) From google translator

 3) Locale Codes 
4) Tutorial Point

1) File->New ->Save report with your fav name to your fav directory.
2) Write a simple query and drag a field to title band( Not necessary to do but iReport requires some query and field otherwise it'll show empty report).
3)Take Text field(Not static text) and write the following.
NOTE: $R is the special syntax used for internationalization of text in iReport.
4) Right click on report Name -> Select properties -> Give Resource bundle Name
Ex: localizationdemo
This is resource bundle name

5) Publish your report to Jasper Server and in resources section add the bundle files.
 You need to add two files..
One file contains general English text(USA) another consists internationalized text
In this example second file having spanish(B'z you are converting English to spanish)

Right click on Resources -> Add -> Resource Bundle  id ,Name and browse for the files
You must add two files.
File 1 ID & Name : localizationdemo.properties  (You can give any of your name , extension is not mandatory). Write this text in file

localization.text1=hello world
File2 ID & Name : localizationdemo_es.properties and add the file from your local machine. Write this text in file
localization.text1=hola mundo

In jasper server Change locale to es-Spanish

See the preview of the report.
Sample output


BI developer