40

The windows installed on my machine has the locale en_AU and that's what JasperReports uses. I already tried changing the locale of all users, including the Administrator but it still uses en_AU.

How can I change that locale? Is it possible to change the REPORT_LOCALE parameter on my report?

Tiago Sippert
  • 1,324
  • 7
  • 24
  • 33
Francisco Fiuza
  • 421
  • 1
  • 5
  • 4

3 Answers3

61

The locale is set during execution, not in the JRXML.

Using Java, set the REPORT_LOCALE parameter for the report's parameter map. For example:

InputStream reportTemplate = getReportTemplate();
JRDataSource dataSource = getDataSource();

java.util.Map parameters = getParameters();
java.util.Locale locale = new Locale( "en", "US" );
parameters.put( JRParameter.REPORT_LOCALE, locale );

JasperFillManager.fillReport( reportTemplate, parameters, dataSource );

Using Jaspersoft Studio, open the project properties dialog to the Report Execution area:

Project Properties

Using iReport, set the report locale in the Options window under the "Report execution options" section in the General tab. This will set the report locale when run.

Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
waxwing
  • 18,547
  • 8
  • 66
  • 82
  • 3
    The "report execution options" have moved to: Options -> iReport -> Compilation and execution -> Execution options – Flo Nov 22 '11 at 16:43
0

You can set the locale on JVM that executes the JasperFillManager code if you do not want to change the code:

java -Duser.language=de -Duser.country=CH ...
siom
  • 1,610
  • 1
  • 14
  • 21
0

The easiest way is to set the locale net.sf.jasperreports.default.locale property in the jasperreports.properties file.

Jan Bodnar
  • 10,969
  • 6
  • 68
  • 77