Message Lookup

Overview

Component Name: gpii.firstDiscovery.msgLookup

File: msgLookup.js

The Message Lookup provides a means for resolving message bundles and accessing individual messages via IoC expressions. Message bundles are the localization strategy used by the Preferences Framework, and should contain all the strings used by a user interface. As such, Message Lookup components are not intended to be used on their own, but provided as a grade to another component that will use its capabilities for displaying messages/strings to a user.

Using the Message Lookup grade

To use the Message Lookup grade, supply it as a gradeNames option in your component definition:

fluid.defaults("my.component", {
    gradeNames: ["gpii.firstDiscovery.msgLookup"],
    ...
});

Grades

This component uses the following base grades:

  • fluid.presf.msgLookup

Subcomponents

This component has the following subcomponents:

NameDescriptionValuesDefault
msgResolver Specifies the type of message resolver to use for resolving the messages from a message bundle "fluid.messageResolver"
msgResolver: {
    type: "fluid.messageResolver"
}

Options

This component can be configured using the following options:

NameDescriptionValuesDefault
messageBase Javascript object containing messages available for the component to output/display. Typically this will be the contents fetched from a message bundle (JSON file). Any valid key/value pairing, where the value is a localized string. The key could also take a namespace by providing a prefix (e.g. namespace-key). This allows for grouping strings to be accessed as an array of strings.
messageBase: {
    "someMessage": "a localized message",
    "myNamespace-string1": "The first localized string",
    "myNamespace-string2": "The second localized string"
}
messageBase: {}
stringArrayIndex Works in conjunction with namespaced message bundle keys to provide an array of strings. A standard object where the key is the name of the grouping, and the value is a an array of namespaced message bundle keys.
stringArrayIndex: {
    someGroup: ["myNamespace-string1", "myNamespace-string2"]
}
stringArrayIndex: {}
rendererOptions Only used when combined with a rendererComponent. This option is used to override the default messageLocator used by the renderer.
NOTE: In general this should not be modified.
rendererOptions: {
    messageLocator: "{msgResolver}.resolve"
}

Dependencies

<script type="text/javascript" src="src/lib/infusion/infusion-custom.js"></script>
<script type="text/javascript" src="src/js/msgLookup.js"></script>