The base.i18n accessors
The base.i18n.* accessors link to the i18n related services provided by the current module's I18nSupport instance.
locale
Answers the desired locale by delegating to I18nSuport.getLocale(HttpServletRequest).
Example
The expression ${calyxo.base.i18n.locale.language} evaluates to the language code for the request's desired locale.
format
Formats the specified message by delegating to Message.format(HttpServletRequest, Locale, I18nSuport).
Example
The expression ${calyxo.base.i18n.format[message]} formats the Message found at attribute "message".
bundle[name]
Answers an accessor, which may be used to retrieve localized resource strings and messages from the specified bundle.
- resource[key] – lookup resource string for the specified key; delegates to I18nSupport.getResource(...)
- message[key][arg 1]...[arg n] – lookup message template for the specified key and format it with the specified arguments; delegates to I18nSupport.getMessage(...)
Examples
Here are some expressions to illustrate looking up resources and messages:
- The expression ${calyxo.base.i18n.bundle['labels'].resource['hello']} gets the resource for key "hello" in bundle "labels".
- The expression ${calyxo.base.i18n.bundle['messages'].message['welcome'][user]} formats the one-argument message with key "welcome" in bundle "messages", using the result of expression user as argument.
- The expression ${calyxo.base.i18n.bundle['messages'].message['goodbye']} formats the zero-argument message with key "goodbye" in bundle "messages".
If a bundle is used more than once in a page, it is recommended to create the bundle bean once, save it to page scope and reuse that instance in subsequent lookups:
<c:set var="labels" value="${calyxo.base.i18n.bundle['labels']}"/>
...
${labels.resource['engine']}
...
${labels.resource['wheels']}
...


