Add support for internationalization
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).
Related: https://github.com/mapfish/mapfish-print/issues/183
Proposed implementation:
- 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_BUNDLEwill be filled for the report.
E.g.:
templates:
A4 landscape: !template
reportTemplate: simpleReport.jrxml
attributes:
i18n: !i18n
resourceBundle: locales.properties
languages: ["en", "de", "fr"]
default: "en"
- When sending a print request, the language can be set as attribute.
E.g.:
{
"layout": "A4 landscape",
"attributes": {
i18n: {
lang: "en"
},
...
}
}
any news on this ?
@petzlux No, this has not been implemented yet.