Chapter 12. Internationalization
Introduction
Struts has long been known as a good framework for constructing
applications that can be used across multiple languages and
geographies. The basis for Struts internationalization (i18n) support
is Java. Java's features for internationalization
and localization are quite mature, having been around since Java 1.1.
At the heart of Struts i18n support is the
java.util.Locale object. This object is used
throughout Struts to identify a client user's
language and country.
You can use Struts to adapt an application to a specific locale using the following features:
MessageResourcesbundles (e.g., properties files) that provide localized messages, prompts, and data formatsCreation of locales based on the user's browser settings
Formatting of dates and numbers using locale-specific patterns
Retrieval of locale-specific images
Ability to specify an appropriate HTTP response character-encoding
Like Struts, JSTL provides tags for localizing data. The JSTL tags are, in many cases, more robust and easier to use than the Struts tags. Thankfully, you don't have to choose one or the other (see Recipe 12.2). The recipes in this chapter give you options for using Struts or JSTL where appropriate.