Localization

Tapestry has built in support for localization, designed to be easy to use. Tapestry allows multiple versions of HTML templates and assets (described in a later section) to be deployed with the application.

Each client connecting to the application will select a particular Locale. When a page for the application is created, the locale is used to select the correct template. Locales are defined by the ISO (International Standards Organization). A locale consists of a language code (such as 'en' for English, 'de' for German or 'fr' for French) and a country code (such as 'AU' for Australia, 'BE' for Belguim, or 'GB' for United Kingdom).

The base template name is derived from the specification name, by changing the '.jwc' extension to '.html. For example, component /com/skunkworx/skunkapp/Banner.jwc will have a base template name of /com/skunkworx/skunkapp/Banner.html. This resource name is used as the basis of a search that includes the locale. Various suffixes are inserted just before the '.html' extension.

A French speaking Belgian visitor would provoke the following search:

The Tapestry framework automatically provides this basic level of support. To this, an application could add custom logic to allow the locale to be selected at runtime, and to store a user's locale preference (in a cookie, or in some form of profile) for later visits.