mapfish / mapfish-print

A component of MapFish for printing templated cartographic maps. This module is the Java serverside module.
http://mapfish.github.io/mapfish-print-doc/
BSD 2-Clause "Simplified" License
186 stars 416 forks source link

Add support for internationalization #245

Open tsauerwein opened 9 years ago

tsauerwein commented 9 years ago

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:

E.g.:

  templates:
    A4 landscape: !template
      reportTemplate: simpleReport.jrxml
      attributes:
        i18n: !i18n
          resourceBundle: locales.properties
          languages: ["en", "de", "fr"]
          default: "en"

E.g.:

{
  "layout": "A4 landscape",
  "attributes": {
    i18n: {
      lang: "en"
    },
    ...
  }
}
petzlux commented 8 years ago

any news on this ?

tsauerwein commented 8 years ago

@petzlux No, this has not been implemented yet.