MM5.8 Label Configuration
Labels in Media Manager 5 can do a bit more than the usual labels.
Most labels in Media Manager 5 are simple key/value pairs, e.g. "ASSET_ARCHIVE" to "Archive". These can be changed as always.
Interpolation
First and foremost it is possible to interpolate values into labels by using double curly brackets, e.g.
{{label}} is a required field*
which will replace {{label}}
with an actual label of a metafield at runtime, so the output of this label might be Title is a required field*
.
Complex labels
More complex labels than above are available, such as
{count, cardinalPlural, one {Asset was added to the collection} other {Assets were added to the collection}}
which can change the available text depending on a parameter. This label is supposed to be read like this:
{PARAMETER_NAME, FUNCTION_NAME, ACTIONS}
PARAMETER_NAME
is a predefined name given based on a variable in the actual code. This should NOT be changed during configuration. The purpose of PARAMETER_NAME
is to give the administrator a hint as to what the variable does.
FUNCTION_NAME
is one of 3 defined functions, each described later on in this documentation.
cardinalPlural ordinalPlural select
ACTIONS
describes how Media Manager should execute the given function, and is very function specific, but always follows the same pattern:
{EXAMPLE_NAME, EXAMPLE_FUNCTION, VALUE1 {Insert this when value 1} VALUE2 {Insert this when value 2}}
The pattern is a value/key followed by some text in curly brackets {}
.
All these rules can be nested arbitrarily, e.g. {uploading, select, false {{open, select, true {Hide} false {Show}} menu} true {{{finished}} / {{total}} {total, cardinalPlural, one {asset} other {assets}} uploaded}}
Select
Select picks whatever available value, the actual parameter value matches. If none matches, it falls back to other
.
For example:
{saving, select, true {Saving...} false {Save}}
when saving
has the value true
Saving...
will be the output. When the value is false
Save
will be the output.
The following are values outputted for different data types:
data type | output |
---|---|
boolean |
|
number |
|
string |
|
Cardinal plurality
Cardinal plurality is when something is counted, e.g. "one asset", "two assets", "three assets" and so on. Cardinal plurality is denoted by the FUNCTION_NAME
cardinalPlural
.
Cardinal Plurality supports two kinds of values. Either straight up numbers, specified by =0
for exactly zero or =420
for exactly 420. These should mostly not be used, but are available due to the spec implementation.
The other kind of values are: zero one (singular) two (dual) few (paucal) many (also used for fractions if they have a separate class) other (required—general plural form—also used if the language only has a single form)
For example
{count, cardinalPlural, one {Asset was added to the collection} other {Assets were added to the collection}}
Which outputs "Asset was added to the collection" is count is 1 in english, and "Assets were added to the collection" if count is not 1.
Which ones are available depends on the chosen language. A full list can be seen here: http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html.
Media Manager 5 has rules for the following languages: English Danish German Swedish
If any additional languages are required, please add a feature request to the MM5 project on JIRA. They don't take very long to add, but we don't want to ship more of them than needed.
For more details about the exact details of plurality rules, check http://cldr.unicode.org/index/cldr-spec/plural-rules.
Ordinal plurality
Ordinal plurality is when something is in relation to something else, e.g. "the first asset", "the second asset", "the third asset" and so on. Ordinal plurality is denoted by the FUNCTION_NAME
ordinalPlural
.
Ordinal plurality otherwise behaves like Cardinal Plurality, expect some of the plurality rules are slightly different.