Java has a mature approach to handling localization involving properties files, or 'resource bundles', and the same need exists on the client-side.
Introducing the l:resourceBundle and l:resourceLabel widgets to make localization easy.
Java Resource Bundles
A Java properties file defines key-value pairs. The values are typically text in a specific language. So the developer can specify that a label should use the key for 'welcome' and an English user will see 'Welcome' while a French user will see 'Bienvenue'.
The l:resourceBundle is a new widget from the Backbase Labs. It wraps the contents of a properties file, parses it, and stores it for use by l:resourceLabel widgets. To use these widgets, you will need to add the namespace xmlns:l="http://www.backbase.com/2007/labs" to your page, and include the widget definitions found in the attachment (resourceBundle.xml).
l:resourceBundle
It is important that the resource bundle is included into the page before any l:resourceLabels try to use the values. Typically that means including the properties file into the html page on the server-side.
A simple jsp:include with some logic to load the properties file that matches the request's locale is sufficient.
<!--
The resource bundle should be included server-side so its ready for immediate use
Note that whitespace is trimmed from both the key and value - see 'bar' line
-->
<l:resourceBundle name="mytest">
foo=Hello my name is {0}
bar = Multiple {0} and {1} may be used.
infact=abc{2} parameters may be {9} any strings {x}, not just digits {Hello} - cool!
</l:resourceBundle>
l:resourceLabel
Once the l:resourceBundle has been parsed, l:resourceLabel widgets can find the label they need by using a key to lookup the relevant text.
<l:resourceLabel bundle="mytest" key="bar" arg0="nouns" arg1="verbs" />
<l:resourceLabel bundle="mytest" key="infact" arg2="def" x="at all" Hello="but whole words" />
An enhancement that Java developers will note immediately is that instead of using only numeric positional parameters, the l:resourceLabel also supports letters and words as parameters.
The sample code is attached and produces the following result. Note that the warning is expected. This is a feature that helps in debugging, in case you forget to specify a parameter that the label expects.

| Attachment | Size |
|---|---|
| resourceBundle.jpg | 164.04 KB |
| resourceBundle.zip | 2.88 KB |
