How to generate localized report in JasperReports Server?

925 Views Asked by At

I've created a jrxml report file. I've added the resourceBundles (pl_PL, en_GB and en_US and the default one also in english) named test.properties, test_pl_PL.properties and so on. And I have added resourceBundle="test" propertety to the tag. I've deployed the report and all related resources.

I am generating my report through rest API v2, namely:

http://localhost:9000/jasperserver/rest_v2/reports/reports/test_summary.pdf

How do I steer in which locale the report is generated? I've tried the Accept-Language in the header (through postman), also I've tried Chrome extensions and Firefox and Opera for all these clientes the report is generated in pl_PL. The only exception is edge browser in which the report is generated in english (default) locale.

2

There are 2 best solutions below

0
On BEST ANSWER

Try to pass Locale via userLocale parameter in URL. Like this:

http://localhost:9000/jasperserver/rest_v2/reports/reports/test.pdf&userLocale=pl_PL
0
On

Well, many years after initial question, but anyway: report itself has an embedded parameter REPORT_LOCALE. You could set it as usual, trough URL. Example: https://example.com/jasperserver/rest_v2/reports/folder/Invoice.pdf?REPORT_LOCALE=bg_BG&InvoiceId=2