Runtime/execution time query based Localization / Internationalization

0

The goal is to make execution time locale selection based on locale persisted in the DB alonside with the consumed by the report data.

The i18n bundles are defined and used in the report. By default Jasper Server uses the server locale or user locale during report execution through REPORT_LOCALE variable.

How can a report locale be set runtime based on locale value from the report select query?

laraslim's picture
Joined: Aug 5 2018 - 3:09pm
Last seen: 1 week 1 day ago

2 Answers:

0

Just put the Locale you want into parameters.

HashMap<String, Object> parameters = new HashMap<>();
parameters.put("REPORT_LOCALE", Locale.JAPAN);

I am Leo's picture
Joined: Jan 3 2020 - 3:13am
Last seen: 4 days 23 hours ago
0

Thank you for the response Tinnt.
I am not sure how to use your suggestion within the report itself. Can you elaborate a bit on how to implement it?

Here are some conditions for the report:

  • No input parameter for locale.
  • Locale is avaible as field in the report data selection.
laraslim's picture
Joined: Aug 5 2018 - 3:09pm
Last seen: 1 week 1 day ago
Feedback
randomness