Commerce Reference Store uses a set of resource files to store translations for any displayable strings that are not stored in repository items. The resource files, located in <ATG10dir>/CommerceReferenceStore/Store/Storefront/lib/classes.jar, include:

The resource bundle that is used is determined by a customer’s current locale.

Determining Which Resource Bundle to Use

To understand which resource bundle gets used, we return to the /includes/context.jspf page fragment:

<dsp:importbean var="requestLocale" bean="/atg/dynamo/servlet/RequestLocale" />
<fmt:setLocale value="${requestLocale.locale}"/>

<dsp:importbean bean="/atg/multisite/SiteContext"/>
<dsp:getvalueof var="resourceBundle" bean="" />

<dsp:importbean bean="/atg/store/StoreConfiguration" />
<dsp:getvalueof var="defaultResourceBundle"
                bean="StoreConfiguration.defaultResourceBundle" />

  Set the resource bundle location from the site context. If it doesn't
  exist in the site context, get it from the configuration file.
  <c:when test="${not empty resourceBundle}">
    <dsp:setLayeredBundle basename="${resourceBundle}"/>

After the RequestLocale component determines the correct locale for a customer (as described in Determining a Customer’s Locale), context.jspf invokes two components:

  • The /atg/multisite/Sitecontext component, from which context.jspf retrieves the current site’s resourceBundle property. If a value for this property exists, it becomes the default resource bundle.

  • The /atg/store/StoreConfiguration component, from which context.jspf retrieves the defaultResourceBundle property. This value becomes the default resource bundle if the current site’s resourceBundle property is null.

All three sites in Commerce Reference Store have their resourceBundle property configured to Commerce Reference Store also configures the StoreConfiguration.defaultResourceBundle property to, so, regardless of where the value comes from, the default resource bundle for Commerce Reference Store is

The default resource bundle is tied to any locale-specific sub-bundles through a naming convention. Specifically, the default bundle WebAppResources is tied to two sub-bundles, WebAppResources_de for the German translations and WebAppResources_es for the Spanish translations. The name extensions for a sub-bundle must include an underscore and a two-letter, lower-case language code as defined by ISO 639.

The fmt:setBundle tag uses both the customer’s current locale and the default resource bundle to determine which resource bundle to set for the JSP page. fmt:setBundle has internal logic that allows it to compare the language portion of the current locale to the filename extensions on any sub-bundles that share the default resource bundle’s filename. For example, the German locale de is matched to the WebAppResources_de resource bundle. This logic allows the fmt:setBundle tag to choose from among a collection of locale-specific sub-bundles. If it cannot find a matching bundle, fmt:setBundle uses the default resource bundle which, for Commerce Reference Store, contains the English translations.

Displaying the Strings

Commerce Reference Store JSP pages use the fmt:message tag to display strings from the current resource bundle. For example, for a customer viewing ATG Store US or ATG Home in English, a Nickname label appears on the address editing form rendered by the store.war/myaccount/gadgets/addressEdit.jsp gadget:

This illustration is described in the preceding text.

This label is rendered using the following fmt:message statement:

<fmt:message key="common.nickNameThisAddress"/>

The fmt:message statement retrieves the “Nickname this address” text from the WebAppResources resource bundle, where the English translations are stored:

common.nicknameThisAddress=Nickname <span>this address</span>

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