Example that shows how to localize strings and formatting based on data from the data source or para

edited June 17, 2014 in DevShare Downloads
This is an update to this DevShare: http://developer.actuate.com/community/forum/index.php?/files/file/720-advance-localization-technique/



BIRT will automatically localize strings (if you setup property files) and formatting (dates, numbers...). However in some cases you want to localize based on data or parameters different than the locale of the user running/viewing the report.



There are two examples attached. One that localizes based on data, the other based on a parameter. The reports were developed in iHub3 (BIRT 4.2), however the same technique can be used in earlier releases.



The code for the label strings looks like this:
importPackage(Packages.java.util);lc = new 
Locale(this.getRowData().getColumnValue("Locale"));

this.text = reportContext.getMessage(this.text, lc);


The code for data formatting looks like this:
this.getStyle().numberLocale = 
this.getRowData().getColumnValue("Locale");
Sign In or Register to comment.