Choice object
Some of the datatypes in the reference can take multiple forms.
This following datatype is either a TranslationStruct
or a FileString
. See the One of the following items:
text.
Translation
One of the following items:
type | description |
---|---|
TranslationStruct | A structured translatable string with placeholders. |
FileString | A simple filestring. This implies that it can also just be a string. |
To represent this datatype in yaml, you would either write a TranslationStruct
or a FileString
.
A TranslationStruct
is specified as follows:
TranslationStruct
field | type | description |
---|---|---|
content | TranslationContent | The content with optional placeholders ({{placeholder-name}}). |
placeholders | Map from String to Translation | The values for the placeholders. It maps the placeholder-name to it's translatable value. The value for a placeholder can thus (if needed) be different for different locales. |
Which could be represented in yaml as follows:
# TranslationStruct
content: Some content
placeholders: {}
The yaml above is thus also a valid yaml for a Translation
.
A FileString
is specified as follows:
FileString
One of the following items:
type | description |
---|---|
String | A string of the form file:<filepath> where filepath is the relative path (within the exams or questions folder) to a file containing content. This content can be localized by placing it in locale folders. e.g. file:examples/basic-explanation.html will search for files in folders with following form: questions/examples/locale-<localename>/basic-explanation.html If a file isn't found for a specific locale, questions/examples/basic-explanation.html will be used. |
String | A literal string. |
Which could be represented in yaml as follows:
# FileString
file:path/to/file
or
# FileString
any string value
The yaml above is thus also a valid yaml for a Translation
.