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:
First,
RequestLocaledetermines if alocaleparameter is included in the HTTP request. Thelocaleparameter is embedded in the links associated with the language picker on thestore.war/navigation/gadgets/languages.jspgadget. When a customer clicks a language in the language picker, an appropriatelocaleis sent in the ensuing HTTP request. (See Rendering the Language Picker in the Multisite Features chapter for more details on the requests generated by the language picker.)If a
localeis not present in the HTTP request,RequestLocalelooks to see if asiteIdis included in the request. If asiteIdis included,RequestLocaleuses the default locale for that site, as defined by thedefaultLanguageproperty in the site’s configuration.If neither a
localenor asiteIdparameter is present in the HTTP request,RequestLocaleretrieves thelocalefrom the customer’s profile.If a
localeis not present in the customer’s profile,RequestLocaleretrieves thelocalefrom the browser’suserPrefLanguagecookie.If the
userPrefLanguagecookie is not present,RequestLocaleuses the browser’s default locale.If the browser does not have a default locale,
RequestLocaleuses its own default setting, as specified by the optionaldefaultRequestLocaleproperty in theRequestLocale.propertiesfile.Finally, if
RequestLocaledoesn’t have a default setting, it uses the JVM’s locale default.
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.

