简体   繁体   中英

How to generate localized report in JasperReports Server?

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.

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM