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

micajblock
edited February 11, 2022 in Analytics #1
This is an update to this DevShare: http://developer.actuate.com/community/forum/index.php?/files/file/720-advance-localization-technique/<br />
<br />
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.<br />
<br />
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.<br />
<br />
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);
<br />
The code for data formatting looks like this:
this.getStyle().numberLocale = 
this.getRowData().getColumnValue("Locale");