Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

DRAFT

Note that this tutorial has not yet been updated to reflect a recent (Oct. 28, 2013) change in the way strings are handled.

Div
classfloatRight
Panel
titleOn This Page
Table of Contents
maxlevel3
minlevel2

...

Message bundles cannot contain arrays. Instead a namespace should be used to group messagekeys message keys together. This will require extra processing when using the messages. (See Using Message Bundles below). Note that the namespace should not include "."; , which is used for path parsing.

...

Message Bundles can also be resolved directly through an IoC Reference reference making use of the the stringBundle property; which can be found an , which is automatically created for any panel component. This process is quite similar to how IoC References references to selectors are resolved.

Code Block
languagejs
fluid.defaults("fluid.slidingPanel", {
    ...
    strings: {
        showText: "{that}.stringBundle.slidingPanelShowText",
        hideText: "{that}.stringBundle.slidingPanelHideText"
    }
    ...
});

...

There are other, more complex cases , where an array of strings is required . To facilitate this a (for example, for a set of radio buttons or a drop-down). In these cases, a stringArrayIndex in the components options needs to be specified. This defines both

  1. which strings to include and
  2. the order in which they should be returned

...

  1. .

It is accessed the same way that an individual string is referenced, except that reference should point to the key in the the stringArrayIndex instead of a single string name. In the example below, the stringArrayIndex is used on line 4 to define the theme string bundle, and the theme string bundle is referenced on line 15:

Code Block
languagejs
linenumberstrue
    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}.stringBundle.theme}", // IoC reference to the array of strings
                optionlist: "${{that}.options.controlValues.theme}",
                selection: "${value}"
            }
        }
    }
    ...
});

...

The strings can also be accessed directly, outside of either the context of IoC references or renderer protoTreeprotoTrees (for example, in an invoker function), by making function calls to the internal StringBundlestring bundle lookup() method.

Code Block
languagejs
 that.stringBundle.lookup(value); // where value is either the string name or the key in the stringArrayIndex to lookup.