| java.util.HashMap com.flexive.faces.beans.MessageBean
MessageBean | public class MessageBean extends HashMap (Code) | | A generic localization beans for messages displayed in the UI. The MessageBean wraps
one or more
ResourceBundle ResourceBundles that provide localized messages for
web applications or plugins. By providing a localized resource bundle with a fixed name
in your plugin/application JAR file, these messages will be automatically detected during
startup and can be accessed through the message beans.
Include the resource bundle with one of the following base names in the root directory
of a JAR file deployed with the application:
Currently both resource bundle types are treated equally, except that all application resource
bundles are queried before the first plugin resource bundle.
Usage: fxMessageBean[key] to get the translation
of the given property name in the user's language.
Parameters in the localized message can be replaced too, by placing EL expressions inside the lookup string:
Using a message declaration of "my.message.key=1+1 is: {0}", the placeholder {0} will be replaced
using the following EL code:
fxMessageBean['my.message.key,#{1+1}']
author: Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at) version: $Rev: 90 $ |
Method Summary | |
public Object | get(Object key) Return the localized message, replacing {0}...{n} with the given args.
< b/>
Parameters may be contained in the key and are comma separated. | public static MessageBean | getInstance() Return the managed instance of the message beans. | public String | getMessage(String key, Object... args) Return the localized message, replacing {0}...{n} with the given args. | public String | getResource(String key) Returns the resource bundle, which is cached within the request. |
BUNDLE_APPLICATIONS | final public static String BUNDLE_APPLICATIONS(Code) | | Resource bundle name for web applications.
|
BUNDLE_PLUGINS | final public static String BUNDLE_PLUGINS(Code) | | Resource bundle name for plugin packages.
|
get | public Object get(Object key)(Code) | | Return the localized message, replacing {0}...{n} with the given args.
< b/>
Parameters may be contained in the key and are comma separated. JSF EL expressions
are evaluated in the current faces context.
Examples:
key="xx.yy.myMessage,myParam1,myParam2"
key="xx.yy.myMessage,#{1+2},#{myBean.value},'some literal string value'"
Parameters: key - the message key (optional with parameters) the formatted message |
getInstance | public static MessageBean getInstance()(Code) | | Return the managed instance of the message beans.
the managed instance of the message beans. |
getMessage | public String getMessage(String key, Object... args)(Code) | | Return the localized message, replacing {0}...{n} with the given args. FxString
objects will be translated in the user's locale automatically.
Parameters: key - message key Parameters: args - optional arguments for the formatted message |
getResource | public String getResource(String key)(Code) | | Returns the resource bundle, which is cached within the request.
Parameters: key - resource key the resource bundle |
|
|