Overview
The framework supports internationalization (i18n) in two different the following places:
- the UI Tags
- Messages and
...
- Errors from the ValidationAware interface (implemented by ActionSupport and ValidationAwareSupport)
- 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 | ||||
---|---|---|---|---|
| ||||
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.
...