This functionality is Sneak Peek status. This means that the APIs may change. We welcome your feedback, ideas, and code, but please use caution if you use this new functionality.
A message resolver is a small component that can be used to look up message codes, inject string fragments into the messages, and return full strings. For most renderer components, a message resolver is automatically created by the Framework. In most other cases, you will likely create a message resolver as a subcomponent in your component tree. See Notes below for more details.
| ||(Object) (optional) A collection of name-value pairs that configure the behaviour of the message resolver. See Options below for more information.|
|Object||A message resolver component object. See below for more information about how to use this object.|
"fluid.rendererComponent") will automatically have a message resolver if the
stringsoption is provided. (If a message resolver is provided to the renderer component through the
messageSourceoption, it will be attached to the renderer component.)
options parameter is an optional collection of name-value pairs that configure the message resolver:
An object containing key/value pairs representing the message keys and the localized text associated with them.
An array of alternative message resolvers that will be searched if a requested key is not found in the current resolver's message base.
Array of fluid.messageResolver
A function that will be used to pre-process the
A function that will be used to resolve any templating specified in the strings.
|An object specifying how to merge options. This is only used in rare cases; the default is typically adequate.||Object|
Accepts an array of keys to look up in the object provided by
messageBase for the current and parent resolvers. It searches through keys and returns an object that contains the first found value. If nothing was found, it returns
undefined. This function first searches the
messageBase from the current resolver, then searches in parent resolvers. Note: The parent bundles are only searched if none of the message keys are found in the current bundle.
NOTE: This function does NOT carry out any template resolution on the resulting string (see fluid.stringTemplate for more information about string templating). If resolution is desired, use
resolve() (see below).
(Array of strings) The list of keys to look up.
an object containing the first matching string and the component's resolver function. The object has the following format
In the example on the left, the
messageResolver searches first for "nokey", then for "key2", and returns the first found value, which is the value for "key2".
In the example on the left, the first lookup (at line 13) searches the current bundle for both "key2" and "key1". Since "key1" is found in the current bundle, it is returned, despite the fact that the first key, "key2" is present in the parent bundle.
The second lookup (at line 16) searches the current bundle for both "key4" and "key2". Since neither exist, it then searches the parent bundle and finds the second key, "key2".
Accepts a key or an array of keys to look up (as described above, in
lookup()). If a string is found the resolver function is used to resolve any string templates (see fluid.stringTemplate for more information about string templating).
(String or Array of strings) A key to look up, or an array of keys to look up.
|(Optional) arguments that will be forwarded to the resolver function specified by the |
|String||the first found value, resolved for any templating, or |