Scripting > mrScriptMetadata User's Guide > mrScriptMetadata reference > Alternative labels
 
Alternative labels
You can define more than one text for each question and category. For example, it is possible to define different texts for each possible combination of user context and label type, although in practice this is not normally necessary. See Contexts and label types for more information.
In addition, you can define translations of each of these texts in as many languages as you require. However, it is generally easier to do bulk translations using a Metadata Document (.mdd) file and a dedicated translation tool, such as Translation Utility.
The default language, user context, and label type are defined for the Metadata section and these are always used for question and category labels when you do not specify otherwise.
Syntax
You specify labels for fields and categories as follows:
<field> ::= field_name [ <label> ] <type-info>
<category> ::= category_name [ <label> ] <cat-modifiers> [ fix ]
  | [list] use define_list [ <label> ] [ fix ]
  | [list] [ <label> ] <categories> [ fix ])
You can also specify labels for the document by creating an info field called HDATA:
<field> ::= HDATA [ <label> ] info
For general information about defining fields and categories, see Field definitions and Categorical.
Parameters
<label>
Defines one or more texts for the field, category, or document, as follows:
<label> ::= ( [ AreaName: ] ( "Label-text" | - ) )*
When not preceded by AreaName, Label-text is in the default language, user context, and label type.
To specify that the label text should be inherited from the first context alternative, replace the text string with a dash (-).For example:
age UC_Analysis: - long;
See also IContextAlternatives in the MDM Object Model Reference.
Area Name
AreaName identifies an alternative language, user context, and label type combination to use. The AreaName keyword must be followed by a colon (:), and there must not be a space between AreaName and the colon. The area name must already be defined in the script. You define area names as follows:
AreaName lcl ( [language] [, [user-context] [, [label-type] ]] )
AreaName must conform to the mrScriptBasic rules for regular identifiers described in Naming conventions, and can be any of the mrScriptMetadata reserved keywords: see Keyword summary.
language
A recognized language code. See Language codes for more information.
user-context and label-type
Define the user context and label type. For details of recognized user contexts and label types, see Contexts and label types.
If you define an area name inside a block or a loop, the name will be visible only within that block or loop. If you define an area name inside a block or loop using the same name as an area code that has already been defined in the parent code, the area name defined within the block or loop will take precedence over the one defined in the parent code.
Example
This example assumes that the default language, user context, and label type have been defined as English, Question, and Label respectively.
This example defines a categorical question with question and category labels in the default language, user context, and label type. Additional labels are defined as follows:
A label with the text “DO NOT ASK” is defined for the question in the Instruction label type.
A Spanish translation of the question label in the default user context and label type.
A label with the text “Gender” is defined for the question in the Analysis user context.
Spanish translations of the category labels in the default user context and label type.
Note that this example uses three area names, which are defined on the first three lines.
LT_Instr lcl ( , ,Instruction);
L_ES lcl (ESN, , );
UC_Analysis lcl ( , Analysis, );

Gender2 "Gender?"
LT_Instr: "DO NOT ASK"
L_ES: "El gnero"
UC_Analysis: "Gender"
categorical [1]
{
male "Male"
L_ES: "Masculino",
female "Female"
L_ES: "La hembra"
};
See
mrScriptMetadata reference