...
- parses and assembles JSON strings loaded by the MessageLoader,
- runs the assembled JSON through the message resolver to create the lookup function, and
- attaches the message resolver bundle as a member, accessible through
"that.msgBundlemsgResolver"
.
To access the message bundle from other components on the IoC tree, use "{prefsEditorLoader}.msgBundlemsgResolver"
.
PrefsEditor
PrefsEditor is the host component that holds all the actual panel (or adjuster) components as subcomponents. By default, the message bundle is not passed down to PrefsEditor. If your PrefsEditor component will need direct access to the message bundle, provide it at the instantiation of any PrefsEditor instance, as shown in the following example:
Code Block |
---|
fluid.prefs.separatedPanel("#myPrefsEditor", { prefsEditor: { msgBundlemsgResolver: "{prefsEditorLoader}.msgBundlemsgResolver" } }); |
If the message bundle is provided to PrefsEditor this way, access it within the PrefsEditor component using "{that}.options.msgBundlemsgResolver"
.
Panels
The message bundle is attached to each panel component as the parentBundle
option. To access it from within a panel, use "{that}.options.parentBundle"
.
...
The Preferences Framework will load and combine all of the Message Bundles into a single Message Bundle which is bound to the prefsEditorLoader
component at the msgBundle
msgResolver
property (as described above).
...
Message Bundles can also be resolved directly through an IoC reference making use of the stringBundle
msgLookup
property, which is automatically created for any panel component. This process is quite similar to how IoC references to selectors are resolved.
Code Block | ||
---|---|---|
| ||
fluid.defaults("fluid.slidingPanel", { ... strings: { showText: "{that}.stringBundlemsgLookup.slidingPanelShowText", hideText: "{that}.stringBundlemsgLookup.slidingPanelHideText" } ... }); |
...
Code Block | ||||
---|---|---|---|---|
| ||||
fluid.defaults("fluid.prefs.panel.contrast", { ... stringArrayIndex: { theme: ["contrast-default", "contrast-bw", "contrast-wb", "contrast-by", "contrast-yb", "contrast-lgdg"] }, protoTree: { label: {messagekey: "contrastLabel"}, expander: { type: "fluid.renderer.selection.inputs", rowID: "themeRow", labelID: "themeLabel", inputID: "themeInput", selectID: "theme-radio", tree: { optionnames: "${{that}.stringBundlemsgLookup.theme}", // IoC reference to the array of strings optionlist: "${{that}.options.controlValues.theme}", selection: "${value}" } } } ... }); |
...
Code Block | ||
---|---|---|
| ||
that.stringBundlemsgLookup.lookup(value); // where value is either the string name or the key in the stringArrayIndex to lookup. |