If your application supports multiple locales, you can localize table column headings with the TableInfo.columnHeadings property.

TableInfo.columnHeadings is a dictionary whose keys are locale-specific variants of a column name and whose values are the column headings to use for the corresponding locales. The following example shows how to use the columnHeadings property in a TableInfo configuration. The TableInfo component is configured to display a two-column table, where column headings are localized for English and French:


# Define the basic table layout using symbolic names for each column.


# Now create localized column headings for each column.

   price=List Price,\
   price_fr=Prix Courant

To support additional locales, simply add their column headings to the columnHeadings list.

Note: This example ignores the country and variant parts of the French locale. You can include country- and variant-specific column headings by using entries such as name_fr_FR=Prix.

A TableInfo component computes the headings for each column by checking whether TableInfo.columnHeadings is set. If it is not set, then the column headings used in the table are the column names, as defined in TableInfo.columns.

If TableInfo.columnHeadings is set, the TableInfo determines the current locale in the following order of precedence:

When the current locale is determined, TableInfo examines the keys in the TableInfo.columnHeadings dictionary, looking for a locale-specific variant of the column name. It applies the same logic that the java.util.ResourceBundle class uses when looking for resource bundles. For example, if the column name is price, and the current locale is fr_FR, then TableInfo searches first for a key named price_fr_FR, next for a key named price_fr, and finally for a key named price. The value corresponding to the first matching key becomes the column’s heading. If no matching key is found, then the column heading used in the table is the column name, as defined in TableInfo.columns.

By using a single TableInfo component that defines locale-specific column headings in TableInfo.columnHeadings, the ATG platform can automatically search for the best available match to the user’s preferred language and locale. However, you can also localize table column headings by defining and configuring an instance of TableInfo for each desired locale. Your JSP can then refer to the appropriate instance depending on the language of the page or the user’s locale. For example, an English-language page might include the following code to import a version of a given table with English column headings:

<dsp:importbean bean="/myapp/tables/en/ItemTable"/>

In turn, a German-language page might include the following code to import a version of the given table with German column headings:

<dsp:importbean bean="/myapp/tables/de/ItemTable"/>

Both pages can then refer to the TableInfo component as bean="ItemTable" and use its own locale-specific version of the component.

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices