When a OriginatingRequest.requestLocale component is created for a session, the component must determine which locale to use for the session. In order to determine which locale to use, a hierarchy of sources is checked for information on setting the locale. By default, this hierarchy is as follows:

This hierarchy is important only to Dynamo Web sites that are configured to serve content to multiple visitor locales. Single language sites that are serving content for the same locale as the server locale do not follow this hierarchy. Sites that are delivering content to one locale that is different from the server locale set a locale for use by all sessions and requests.

Note: The DynamoHandler.generateRequestLocales property must be set to true to generate a RequestLocale for each session. By default, the property is set to false.

Customizing the Hierarchy

The hierarchy of locale sources can easily be expanded to include custom sources. You can sub-class atg.servlet.RequestLocale and override the method:

public Locale discernRequestLocale (DynamoHttpServletRequest pRequest,
                                      RequestLocale pReqLocal)

This method returns the locale to use in the RequestLocale. Add super.discernRequestLocale() at the end of your overridden method so that the default request locale is set if no other source provides a locale. Finally, change the class used by the /atg/dynamo/servlet/RequestLocale component to that of your new RequestLocale sub-class.

loading table of contents...