Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated overview to include mention of i18n support in actions. Added an example using the "key" attribute of UI tags

Overview

The framework supports internationalization (i18n) in two different the following places:

  1. the UI Tags
  2. Messages and

...

  1. Errors from the ValidationAware interface (implemented by ActionSupport and ValidationAwareSupport)
  2. Within actions that extend ActionSupport through the getText() method

Resource Bundle Search Order

...

There are several ways to access the message resources, including getText, the text tag, and the i18n tag.

Using getText from a Tag

To display i18n text, use a call to getText in the property tag, or any other tag, such as the UI tags. (The getText technique is especially useful for labels of UI tags.)

...

Tip
i18n with SiteMesh
i18n with SiteMesh

Internationalizing SiteMesh decorators is possible, but there are quirks. See SiteMesh Plugin for more.

Using the Key attribute of UI Tags

The key attribute of most UI tags can be used to retrieve a message from a resource bundle:

Code Block
<s:textfield key="some.key" name="textfieldName"/>

I18n Interceptor

Essentially, the i18n Interceptor pushes a locale into the ActionContext map upon every request. The framework components that support localization all utilize the ActionContext locale. See I18n Interceptor for details.

...