When you want to create other locales for JasperReports Server, translation is only one aspect of localization. Creating a locale includes these tasks:
• | Translating labels and messages |
• | Creating a Resource Bundle |
• | Setting Date and Datetime Formats |
The tasks in this section require you to edit these files:
File | Location | Purpose of Edits |
*.properties files | .../WEB-INF/bundles | Translating labels and messages |
jasperserver_config.properties | .../WEB-INF/bundles | Changing date formats |
About Properties Files
Resource bundles for JasperReports Server and Jaspersoft OLAP are Java properties files found in the .../WEB-INF/bundles directory. The properties files contain all the labels and messages used in JasperReports Server and Jaspersoft OLAP.
A bundle includes a default locale (for example, jasperserver_messages.properties), which is written in U.S. English. Then it consists of all the properties files with the same base name, but different locale (such as jasperserver_messages_fr.properties). Each file translates all of the strings of the default file into the language given by the locale. The Java programming language has rules for specifying locales and alternate locales and determining which locale in the bundle to use.
Default Resource Bundles in JasperReports Server | |
File in .../WEB-INF/bundles | Description |
accessibility_messages.properties | Text spoken in accessibility software such as screen readers. |
AttributeBundle.properties | Messages for attribute validation. |
AttributeBundles.properties | Messages for attribute dialogs. |
calendar.properties | Labels and messages used by the pop-up calendar dialog. |
.properties | . |
CommonBundle.properties | Bundle for tests. |
HomeBundle.properties | Labels for the home page. |
image_descriptions_messages | Labels and messages for the AWS (Amazon Web Services) machine images. |
jasperreports_highcharts_ | Messages for charts in the report viewer. |
jasperreports_messages | Labels and messages for the report viewer. |
jasperserver_config.properties | Configuration properties for dates and date-times. |
jasperserver_messages.properties | Labels and messages used in the main JasperReports Server user interface. |
jsexceptions_messages.properties | Messages used in errors and exceptions, both in the UI and in the log messages. |
LicenseMessages.properties | Labels and messages used when validating licenses. |
logger_descriptions.properties | Internal log messages. |
pro_nav_messages.properties | Labels and messages for the menu bar and Home page. |
ScalableInputControlsBundle | Labels for lists of values in input controls. |
scheduling_ws.properties | Validation messages for the report scheduler. |
security.properties | Messages used by input validation. |
ValidationBundle.properties | Messages for dashboard dialogs. |
Default Resource Bundles in Jaspersoft OLAP | |
File in .../WEB-INF/bundles | Description |
ja_mondrian.properties | Labels and messages in the OLAP settings UI. |
ja-pro_messages.properties | Labels and messages in the commercial edition OLAP viewer. |
jpivot_messages.properties | Labels and messages in the community edition OLAP viewer. |
mondrian_exception_messages | MDX validation error messages specific to the internal analysis engine. |
The standalone import and export tools have their own bundles located outside of the web app. The following bundles are located in the WAR file distribution package, under the buildomatic folder.
Default Resource Bundles for js-export.sh and js-import.sh | |
File in buildomatic/conf_source/ieCe/bundles | Description |
---|---|
ji-export-messages.properties | Labels and messages for js-export --help. |
jsexceptions_messages.properties | Messages used in errors and exceptions, both in the UI and in the log messages. |
Creating a Resource Bundle
Create a resource bundle by making a copy of each *.properties file, using the following syntax for the copy's file name:
<default_file_name>_<locale>.properties
where
<default_file_name> is the name of the default version of the properties file, and
<locale> is a Java-compliant locale identifier.
For example, consider the core JasperReports Server resource bundle. For various locales, it might be named as follows:
Language | File Name |
Default (English) | jasperserver_messages.properties |
French | jasperserver_messages_fr.properties |
French in Switzerland | jasperserver_messages_fr_CH.properties |
For a list of Java-compliant locales, please refer to the Java documentation.
The resource bundles described in this document consist of locale-specific Java properties files. Java properties files use the ISO-8859-1 (Latin-1) encoding that is the same as ASCII for all English non-accented characters. For international characters that are not in ISO-8859-1, use Unicode escape sequences (for example u00e9 is é). |
To create a new JasperReports Server resource bundle:
1. | Copy each of the properties files (keeping them in the same directory as the originals) and rename them according to your locale. |
2. | Translate each *.properties file's labels and messages into the new language. |
Some of the strings in the properties files are date formats and format masks that may need to be edited for the new locale. For more information, refer to Setting Date and Datetime Formats.
3. | Save the files. |
4. | If the new locale requires specific character encoding or fonts, ensure that JasperReports Server and the third party software it relies on are configured to support them. For more information, refer to Configuring JasperReports Server for Multibyte Fonts. |
The new locale is not available in JasperReports Server until you follow the steps described in Specifying Additional Locales. |
Setting Date and Datetime Formats
Each locale may have its own rules for displaying dates and datetime values. System date and datetime formatting is controlled by four patterns that are specified in the jasperserver_config_<locale>.properties file associated with a particular locale.
For example in the English resource bundle, the four entries are:
The first two keys are used to parse and format dates and datetime values using an internal java.util.DateFormat object across the whole application. These patterns should be non-localized date patterns, in accordance with the Java Development Kit (JDK) syntax.
The other two keys are used by the calendar control, which formats the user-selected date and datetime values in accordance with its own pattern syntax.
To change the system date and datetime formatting for a new locale, edit the strings specified by these keys.
Recommended Comments
There are no comments to display.