Skip to content
Mrdigs edited this page Apr 8, 2014 · 5 revisions

All label attributes have built in support for localization.

The label contents are looked up in a MessageBundle For the user's request locale. As usual with a MessageBundle, the default bundle is looked up if none exists for a given locale.

The key used for the look up is the label text, lowercased, with any spaces replaced with underscores.

If the lookup returns nothing then the label text is used unchanged. There is no MessageBundle file in the distribution and so this is the default result if all lookups.

This means that if you need to provide localized versions of the labels, then you have a choice of either supplying a default MessageBundle that will translate all labels to the language of your choice, or locale specific messages for your target users locales.

This is useful if you want to use some of the molds that use labels in English when your target language is not.

For example, to provide a French version of the yes and no button molds, simply create a file in your WEB-INF/lib folder with the content as:

yes=Oui
no=Non

Then use the button tag as normal:

<b:button mold="yes"/>
<b:button mold="no"/>

This functionality is provided by the Message tag, which you can also use directly:

<b:message value="Yes"/>
Clone this wiki locally