The recommended way to translate a JasperReports template is to create a properties file for each language (e.g. locale.properties, locale-fr.properties), to set the resourceBundle property in the template and then to use the translated strings with $R{locale.text1} (see JasperReports - Internationalization).
The only problem is that the resource bundle, that is the property files have to be on the class path. We could either add the directories with the print configuration to the class-path or manually load a ResourceBundle instance and pass this instance to the template with JRParameter.REPORT_RESOURCE_BUNDLE (see here).
Add a property to the YAML configuration to specify the language settings (resource bundle, available languages, default language). When this property is set the parameter JRParameter.REPORT_RESOURCE_BUNDLE will be filled for the report.
The recommended way to translate a JasperReports template is to create a properties file for each language (e.g.
locale.properties
,locale-fr.properties
), to set theresourceBundle
property in the template and then to use the translated strings with$R{locale.text1}
(see JasperReports - Internationalization).The only problem is that the resource bundle, that is the property files have to be on the class path. We could either add the directories with the print configuration to the class-path or manually load a
ResourceBundle
instance and pass this instance to the template withJRParameter.REPORT_RESOURCE_BUNDLE
(see here).Related: https://github.com/mapfish/mapfish-print/issues/183
Proposed implementation:
JRParameter.REPORT_RESOURCE_BUNDLE
will be filled for the report.E.g.:
E.g.: