4.8.3  Localizing Reports, Viewsheets, Data Models/Queries

You can use a simple text mapping to localize most text in a report or Viewsheet, as well as data source names, data model names (entity/attribute), and query (column) names.

The first step in setting up localization for a particular report or Viewsheet is to assign Text IDs to each text element to be mapped. You can do this in the 'Localization' dialog box of Style Studio (for reports) and the 'Options' dialog box of Visual Composer (for Viewsheets). See Localization/Internationalization in Report Design and Localization/Internationalization in Dashboard Design for more information.

After you have assigned Text IDs to report and Viewsheet elements, you can create the mapping file (“resource bundle”) that specifies the text substitutions for these elements. The mapping file should be given the following name,

SreeBundle_{language}_{country}.properties

where {language} and {country} are the ISO-standard two-letter codes for language and country. For example, the localization mapping file for Canadian French speakers should be called 'SreeBundle_fr_CA.properties'. All report/Viewsheet localization (“SreeBundle”) files must be available on the classpath, preferably in the sree/WEB-INF/classes directory. If the appropriate mapping file for the user's locale selection cannot be found at runtime, no localization is performed.

Similar to the “srinter” files for Portal interface localization (see Localizing the User Portal Interface), each line of text in the report/Viewsheet localization file has the following format:

{element_id}={translated_element_id}

The {element_id} is the Text ID assigned to the report or Viewsheet element in Style Studio or Visual Composer. Spaces in the {element_id} must be escaped by a backslash, for example, 'Head\ 1'.

The {translated_element_id} is the translated text that you want to appear in the corresponding report or Viewsheet element. Spaces in the {translated_element_id} do not need to be escaped.

For example, the French Canadian localization file mentioned above, 'SreeBundle_fr_CA.properties', might contain the following lines of text, where, for purposes of illustration, “State_fr” is used as the French translation of “State,” and so on:

title=Localized Title_fr

state\ header=State_fr

sales\ header=Sales_fr

The above mapping translates the text corresponding to three Text IDs, (which might be assigned in a report or Viewsheet) into the specified mock French text:

Text ID

Translated Text

title

Localized Title_fr

state header

State_fr

sales header

Sales_fr

The following example illustrates the use of a similar mapping that also translates data source names.

Example: Report Element Localization  >>

In this example, you will configure a report for French Canadian localization.You will also localize a data source name and a query name.

1. Open Style Studio, and create a blank tabular report.

2. Add a text element with the text 'Report Title'. Format the text as desired.

3. Add a table, and bind it to the 'Orders' > 'sales by state' query.

4. Add a bar chart, and bind it also to the 'Orders' > 'sales by state' query. In the Chart tab of the 'Data Binding' dialog box, add 'State' on the X-axis and 'Sales' on the Y-axis.

 

You now have a report with three elements, and will assign Text IDs to several of the text components provided by those elements.

5. Open the 'Localization' dialog box from the Style Studio 'Report' menu.

6. Expand the component tree to view the text components which can be assigned Text IDs.

 

7. Enter the following IDs in the 'Text ID' field for the corresponding components.

text1: report title

State: state header

Sales: sales header

X Axis Title: X

Y Axis Title: Y

Leave the Text ID box empty for the remaining elements. (See the Localization/Internationalization section of the Report Design for more information about adding Text IDs.)

8. Save the report, and deploy it to the Repository under the name 'Localization_Exp'.

You now have a deployed report with elements configured for localization. To enable localization to take place when the report is viewed, you must create the resource bundle that translates the assigned Text IDs into the desired text for the French Canadian locale.

9. Create a text file called 'SreeBundle_fr_CA.properties', and insert the following text:

report\ title=Localized Report_fr

state\ header=State_fr

sales\ header=Sales_fr

X=Sales By State_fr

Y=Revenue_fr

 

Orders=Orders_fr

All\ Sales=All Sales_fr

Note that the final two lines of the mapping file specify a transla­tion for the 'Orders' data source and the 'All Sales' query.

10. Save the file in the sree/WEB-INF/classes directory.

With the report elements assigned text IDs, and the resource bundle file appropriately named and placed on the classpath, you now need to register the locale in the Enterprise Manager.

See Localization/Inter­nationalization for details on registering locales.

11. In the 'Localization' page of the Enterprise Manager, add a new locale.

a. Specify 'fr' and 'CA' for the language and country codes, respectively.

b. Set the 'Locale Label' to “French (Canada)”.

When the user logs in and specified 'French (Canada)' in the 'Locale' login menu, they will view the 'Localization_Exp' report with the desired localization applied. The report title, table column headings, and chart labels have all been translated as specified.

Figure 10. Report with localization applied.

 

Because the mapping file also specifies translations for a data source and query, if the user opens the 'Data Source' dialog box from within the Ad Hoc tool, they will see the specified translations for the 'Orders' datasource and the 'All Sales' query.

 

 

<< 4.8.2 Localizing the User Portal Interface © 1996-2013 InetSoft Technology Corporation (v11.5) 4.8.4 Defining Custom Number Format Multipliers >>