MM5.7 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.