Java Reference
In-Depth Information
Figure 11.1: The Login page in English
The text we see on this page comes from three sources:
• Form field labels: This includes the “Primary email” and “Pass-
word” labels as well as the
Login
button.
• Error and information messages: In this case, this is “The pass-
word is incorrect.”
• Free-form text: Basically, that's all the other text we see in the
page.
11.2
Translating the Text of an Application
Let us now see how Stripes looks up resource bundle keys for the three
sources of text.
Translating Form Field Labels
Stripes looks up form field labels in the Form field bundle, which is in
StripesResources
by default.
We've seen how the <s:label> tag can be used to look up the text for a
field label in the resource bundle. For example, if the
contact.firstName
field is in the
stripesbook.action.ContactFormActionBean
and we use
<s:label for="contact.firstName">
in the JSP, Stripes looks for a label in
this order of priority:
1. In the resource bundle, using the key:
stripesbook.action.ContactFormActionBean.contact.firstName
2. In the resource bundle, using the key:
contact.firstName
Search WWH ::
Custom Search