The language picker allows the customer to switch between English and Spanish when ATG Store US or ATG Home is the current site, and English and German when ATG Store Germany is the current site. In order for this functionality to be available, the Store.Estore.International
module must be running in your production instance.
Note: When the International
module is absent, ATG Store US and ATG Home are only available in English and ATG Store Germany is not available at all.
Rendering the Language Picker on ATG-Driven Pages
The language picker is implemented by the store.war/navigation/gadgets/languages.jsp
gadget. To begin, languages.jsp
tests whether or not the /atg/modules/InternationalStore
component exists. This component is part of the Store.Estore.International
module and only exists when that module is running. The presence of the InternationalStore
component indicates that the International
module is running and, therefore, this application has language support and a language picker should be rendered.
Next, languages.jsp
invokes the /atg/store/droplet/DisplayLanguagesDroplet
, passing in as parameters the languages
and defaultCountry
properties of the current site. The DisplayLanguagesDroplet
is of class atg.projects.store.droplet.DisplayLanguagesDroplet
and it has two tasks: it determines which language is currently selected and it creates a set of objects, one for each language the current site supports. In general, these objects contain a modified URL that consists of the current URL plus a locale parameter. For example, if the URL for the current page is:
http://localhost:8180/crs/storeus/index.jsp
The modified URL might be:
http://localhost:8180/crs/storeus/index.jsp?locale=es_US
There are some exceptions to this rule for parameters that are not appropriate to carry over to the modified URL. For example, the numResults
parameter is omitted in any newly formed URLs because a search in a new language will return different results.
Finally, languages.jsp
uses the objects returned by DisplayLanguagesDroplet
to render the language picker. The currently selected language is rendered as a label only. Any other languages are rendered as links using the URLs in the objects the DisplayLanguageDroplet
returned.
Note: See the Internationalization chapter for more information on the International module.
Rendering the Language Picker on Default Browse Page
The default browse page requires a different approach when changing language. By definition, the search results that appear on the default browse page are tagged with the dimension values specified in the current query. For example, if the current query is Color=Green, the search results that are returned are tagged with the Green dimension value in the Color dimension. Upon switching languages, you are effectively performing a search for Color=Green against a set of German or Spanish records. Because the color Green is represented by a different word in German and Spanish, this query returns zero results.
Because of this situation, Commerce Reference Store modifies the URL in the following ways when switching languages on the default browse page:
If multiple non-Category dimension values are selected, upon switching language, you are brought to the default browse page in the chosen language but all dimension values are stripped from the query. In other words, the default browse page is rendered in the chosen language but with an unfiltered list of products displayed.
If a Category dimension value is selected with or without other non-Category dimension values, upon switching language, you are brought to the category page in the chosen language with the previously selected Category dimension value still in effect. All other dimension values are stripped from the query.
Note: For more details on the differences between the category page and the default browse page, see the Using Cartridges chapter.