Java Reference
In-Depth Information
Download email_20/web/WEB-INF/jsp/common/message_action.jsp
<s:select name="selectedFolder">
<s:option value="">
<fmt:message key="messageList.selectAFolder"/> ...
</s:option>
<s:options-collection collection="${folders.folders}"
value="id" label="name"/>
</s:select>
For each Folder , Stripes calls getId ( ) for the value and getName ( ) for the
label. To look up localized labels, Stripes looks for a key that starts with
the class name ( Folder ), optionally prefixed by the package ( stripesbook.
action ), and followed either by the string returned by getName ( ) or by
getId ( ). Using the class name without the package, followed by the name
of the folder, we get the following entries in the resource bundles:
Download email_20/res/StripesResources.properties
Folder.Inbox=Inbox
Folder.Sent=Sent
Folder.Reference=Reference
Folder.Trash=Trash
Download email_20/res/StripesResources_fr.properties
Folder.Inbox=R\u00e9ception
Folder.Sent=Envoi
Folder.Reference=R\u00e9f\u00e9rence
Folder.Trash=Poubelle
That's all we need to translate the options in the select box. Options
rendered by <s:options-enumeration> and <s:options-map> work es-
sentially in the same way: the class name with or without the package
prefix, followed by the label or the value. If we had used a select box for
the gender and <s:options-enumeration> to generate options from the
Gender enumeration, we could have added these entries in the French
resource bundle:
stripesbook.model.Gender.Female=F\u00e9minin
stripesbook.model.Gender.Male=Masculin
Localizing Image Buttons
One last type of input control that it is worth mentioning while talking
about localization is the image button. If we're using localized images,
you can use the resource bundle to get the <s:image> tag to use the
image associated to the current locale. As with other input controls, the
key is the same as the name= attribute of the tag, optionally prefixed
with the action bean class name. To indicate the path to the image,
 
 
 
Search WWH ::




Custom Search