Bookshelf Home | Contents | Index | PDF |
Implementation Guide for Oracle Self-Service E-Billing > Using the Reporting Engine > Core Reporting Features > Internationalization and Localization of ReportingResource bundles are used to support internationalization. This topic discusses internationalization for Velocity templates. Because the Reporting Engine uses Velocity templates, you cannot take advantage of the JSP <message> tag or the Struts internationalization framework. Instead, the Reporting Engine has its own internationalization mechanism specially designed for Velocity templates, which has following features:
For internationalization of reporting, you translate the following text:
Resource Bundle DefinitionThe resource bundle files used by the Reporting Engine templates are defined in the report XML files under the <reports> tag. The following example comes with Oracle Self-Service E-Billing, and is defined in the telco_global.xml file. <localizer enableMessageResources="true" defaultCode="1"> Follow these naming guidelines for localizing resource bundles:
When the Reporting Engine searches for the resource bundle, it first checks whether this bundle exists as a file under EDX_HOME (the directory where you installed Oracle Self-Service E-Billing), or the current directory if EDX_HOME is not defined. If the file does not exist, then the Reporting Engine searches for the bundle as a class. The attribute enableMessageResources enables you to use Struts MessageResource to search for a resource. The attribute defaultCode enables you to define the default behavior if a resource is not found. 0 means to use the key as the default value. A value of 1 means to use Struts notion of "Text<locale>.<key>Text" and -1 means throw an exception. The default value for the attribute defaultCode is 0. The search order for finding a resource is:
Follow these guidelines when defining a resource bundle:
Localization of Report TextThe localization of text in report is done through the #localize macro, which is defined in reporting_library.vm. It is defined as: For example, in your template, you can call this macro as follows. This expression searches the report bundle to find a key with a value that matches name: All the texts defined in the report.xml file are treated as resource bundle keys. For example, report names and column labels. In the report template files, all the texts are localized through the #localize macro. Localization of Report Data from a Data SourceBy default, the text data retrieved from data source is not localized. You must turn on this option. In this case, the text data from data source will be used as keys to search reporting resource bundles. The localization of data from data source is done through the localize attribute of transformer column configuration in report XML. <column id="call type" localize="true" /> The column data retrieved from the Oracle Self-Service E-Billing database will be localized. Localization of ChartsThe chart components (chart title, labels and data) are localized by the ITransformer.writeChart() method. The chart tile is searched as a regular resource bundle name. Label and data are localized if the localize attribute is set to true for the corresponding columns. LocaleTo support internationalization, you must pass the Locale object to ReportContext by calling setLocale(). If ReportContext does not have a locale defined, then when you call the IReportActionHelper.execute() method, it puts the Struts locale object in session. Dynamic LocalizationVelocity is used to support localization. Velocity acts similar to the way java.text.MessageFormat does, and achieves the same result. The Reporting Engine parses the resource value as a Velocity template, whose resource key ends with .vm, and returns the parsed value. For example, Object name must come from the report context. This feature can make any text in your report dynamic. For example, on the account detail page, to display the report tile as Account detail for <account_number> instead of the default text, define the report title as a .vm resource bundle. In the following example, accountNumber is from the Struts ActionForm: rpt.accountDetail.title=Account detail for $form.accountNumber |
Implementation Guide for Oracle Self-Service E-Billing | Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |