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:
Applications can switch between international and non-international modes without requiring any JSP page changes. The same property names are used in the JSP page code and each repository derives the appropriate language as necessary.
No database schema changes are required to add additional languages.
To extend your repository to include internationalized values, follow these steps:
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.
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
SKUproperties:displayName,description,size, andcolor. You would add four new properties (displayNameDefault,descriptionDefault,sizeDefault, andcolorDefault) to theSKUitem 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, andcolorcolumns, where default-language text for the content are stored.Add another property to the item type. This property (with a name such as
translations) is a map whose key is alocaleand whose value is an item of typebaseTypeTranslation, described below. Note that thelocalekey does not have to be a fully qualified locale.Define a set of helper item types for all existing item types that have translatable properties. Our example uses the naming convention
baseTypeTranslation, wherebaseTyperefers to an existing item type; for example, create askuTranslationitem type to correspond with theskuitem type, aproductTranslationitem type for theproductitem type, and so on.baseTypeTranslationitems function as containers for locale-specific content. As such, eachbaseTypeTranslationitem 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, andcolor).Therefore, theskuTranslationitem also has four properties fordisplayname,description,size, andcolor. EachbaseTypeTranslationitem type has its own table in the database, where each row represents a singlebasetypeTranslationitem with a unique ID. For example, thecbp_sku_xlatetable contains all theskuTranslationitems, thecbp_prd_xlatetable contains all theproductTranslationitems, 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.

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:
Use the current locale to look up a corresponding
baseTypeTranslationitem in thetranslationsproperty map. The property derivation attempts to find a best match. First, it searches thelocalekeys for a match on the entire locale with a variant, then it searches for a match on the locale without a variant, and finally it searches on just the language code.If a
baseTypeTranslationitem exists for the current locale, use its value for the property.If a
baseTypeTranslationitem does not exist for the current locale, or its value for the property is null, use thetranslatablePropertyDefaultvalue instead.
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:
giftListShop.jsprequests thesku.displayNameproperty for a SKU and determines the locale, which in this example isDE_de.The catalog repository finds the corresponding
skuTranslationitem using thetranslationsproperty map. Based on the locale, the repository determines that it should reference the GermanskuTranslationitem.The catalog repository returns the
displayNameproperty from the GermanskuTranslationitem.If no
skuTranslationitem exists for the locale, it returns the value fromdisplayNameDefault.

