Message Lookup API

Message Lookup Overview

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 it's capabilities for displaying messages/strings to a user.


Adding Message Lookup to a Component/Grade

To mixin the Message Lookup into your Component/Grade:

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

Grades

The base grades used by the Message Lookup:

  • fluid.prefs.msgLookup

Subcomponents

Name

Description

Values

Default

msgResolver

Specifies the type of message resolver to use for resolving the messages from a message bundle.

"fluid.messageResolver"

msgResolver: {
    type: "fluid.messageResolver"
}

Options

Name

Description

Values

Default

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>