A customer’s locale determines the language that the customer sees when viewing a site in Commerce Reference Store. This section describes how a customer’s locale is determined for each request.

Setting a customer’s locale is implemented through a series of includes. To start, an include-prelude statement in the /WEB-INF/web.xml file specifies that the store.war/includes/prelude.jspf page fragment should be included for all Commerce Reference Store JSP pages. prelude.jspf, in turn, includes the store.war/includes/context.jspf page fragment. This fragment contains code for identifying and setting the customer’s locale and it looks like this:

<%-- Identify and set customer's locale --%>
<dsp:importbean var="requestLocale" bean="/atg/dynamo/servlet/RequestLocale" />
<fmt:setLocale value="${requestLocale.locale}"/>

The context.jspf fragment invokes the /atg/dynamo/servlet/RequestLocale component included in the Store.EStore.International module. RequestLocale is of class atg.projects.store.servlet.StoreRequestLocale, which extends the atg.userprofiling.ProfileRequestLocale class with the following logic that determines a user’s locale:

Once a locale is determined, RequestLocale sets the locale property in the customer’s profile and writes a userPrefLanguage cookie to the browser that specifies the customer’s locale.

The context.jspf page fragment also calls the fmt:setLocale tag from the JavaServer Pages Standard Tag Library (JSTL). This tag sets the locale for any additional fmt tags called for the remainder of the request, such as the fmt:message tags that are used for displaying localized strings (see Displayable String Translations for more information).

Note: For more information on JTSL tags, see http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html.

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