If you want to internationalize your product catalog, you can extend the Commerce repository to support translated versions of some properties. This section outlines the internationalization strategy that is implemented as part of the Oracle ATG Web Commerce Reference Store. This “best practice” offers the following benefits over other approaches:

To extend your repository to include internationalized values, follow these steps:

  1. Decide which properties of which item types you want to translate. This example uses properties of the SKU item type, but you may need to translate product, category, and even catalog properties, depending on your catalog structure.

  2. For each item type you are internationalizing, add new properties corresponding to that item type’s translatable properties.

    For example, you want to provide internationalized versions of four SKU properties: displayName, description, size, and color. You would add four new properties (displayNameDefault, descriptionDefault, sizeDefault, and colorDefault) to the SKU item descriptor.

    The new properties refer to the original properties’ database columns and represent the default text for the properties (thereby allowing us to redefine the original properties as derived properties).

    These four properties refer to the display_name, description, sku_size, and color columns, where default-language text for the content are stored.

  3. Add another property to the item type. This property (with a name such as translations) is a map whose key is a locale and whose value is an item of type baseTypeTranslation, described below. Note that the locale key does not have to be a fully qualified locale.

  4. Define a set of helper item types for all existing item types that have translatable properties. Our example uses the naming convention baseTypeTranslation, where baseType refers to an existing item type; for example, create a skuTranslation item type to correspond with the sku item type, a productTranslation item type for the product item type, and so on.

    baseTypeTranslation items function as containers for locale-specific content. As such, each baseTypeTranslation item type has properties that correspond to the translatable properties of its base item type. In our example, we have selected four SKU properties for translation (displayName, description, size, and color). Therefore, the skuTranslation item also has four properties for displayname, description, size, and color. Each baseTypeTranslation item type has its own table in the database, where each row represents a single basetypeTranslation item with a unique ID. For example, the cbp_sku_xlate table contains all the skuTranslation items, the cbp_prd_xlate table contains all the productTranslation items, and so on.

Every base item (SKU, product, category) is tied, through its translations property, to one or more baseTypeTranslation items (one for each locale, with the exception of the default locale). The following example shows three sku items and six corresponding skuTranslation items which contain translated content for two locales, French and German.

This diagram described in preceding text

To create the relationships that connect a base item to its baseTypeTranslation items, change the definitions of the translatable properties in the existing item types. The new definitions should specify that each translatable property is a derived property whose value is determined as follows:

The Oracle ATG Web Commerce Reference Store code uses the atg.repository.dp.LanguageTranslation class to implement the derivation.

The following example shows how Commerce Reference Store derives the sku.displayName property for a store that has English (default), German, and French translations:

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