Jump to content
Changes to the Jaspersoft community edition download ×

Localisation in Sub Report


Recommended Posts


I'm trying to create a report with multiple subreports contained within it that is localised. I've passed the REPORT_RESOURCE_BUNDLE and the REPORT_LOCALE to JasperFillManager using the hash map of parameters. 

The translations are working on the master report, however all sub reports are still in english, despite passing the master reports parameters to them via the parameterMapExpression. I have also confirmed the correct parameters (resource bundle and locale) have been passed to the sub report by printing them onto the sub report. 

The properties files are named in the convention:
messages_es.properties, messages_fr.properties etc..

I'm creating the hashmap as follows:

final ResourceBundle resourceBundle = ResourceBundle.getBundle("org.example.messages", new Utf8Control());parameters.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle);parameters.put(JRParameter.REPORT_LOCALE, printParameters.getLocale());final JasperPrint jasperPrint = JasperFillManager.fillReport(layoutJasperReport, parameters, jasperDataSource);[/code]

Then in the master report, I'm passing the parameters to the sub report like this:

<subreport>...    <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>...</subreport>[/code]

Finally, in the sub report i'm trying to get a localised property by using:

<textField>...    <textFieldExpression><![CDATA[$R{key}]]></textFieldExpression>...</textField>[/code]

Could anyone offer some insight into why this could be happening? 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...