Spreadsheet Layout (Object)
The layout enumerates the segment fields to return when retrieving segments. In the translation editor, the layout specifies the editor columns. Fields may be source text, translation(s), comments, etc.
CREATING LAYOUTS
Columns
A layout is an ordered list of columns. Each column contains specific data from a segment.
Note that all the core properties of a segment such as its ID are always returned by queries independently from the columns.
A sample layout to retrieve English and French texts would be:
"layout" : {
"columns": [
{ "fkey": "1~en~0" },
{ "fkey": "1~fr~0" }
]
}
The "fkey" uniquely identifies a data column. It is composed as follows:
{ftype}#{loc}#{fqualifier}
- "ftype" is the type of the column (a number)
- "loc" is the language of the column (if the column is specific for a language)
- "fqualifier" is used with custom field and label columns only and corresponds to the CF/label id.
Column types
Available column types are:
Field type (ftype) | Description of column content | Segment or Language |
---|---|---|
1 | The source text or target text of a segment. | Language |
2 | Context of the segment. | Segment |
3 | Status of a text. | Language |
4 | Origin of current text version: Human translation, pretranslation, etc. | Language |
5 | Locked status | Language |
6 | Bookmark | Language |
7 | Custom field. Requires specification of "fqualifier" in the "fkey". This is the ID of the custom field. If the language is specified then the column contains the language specific CF. Otherwise it contains the CF that refers to the segment as a whole. | Both |
8 | Label. Requires specification of "fqualifier" in the "fkey". This is the ID of the label. | Both |
9 | Comments | Language |
10 | Memory hits. NOT IMPLEMENTED. | Language |
11 | A column that allows a user to add a new comment. For internal use only. | Language |
12 | Revisions | Language |
13 | Error information. For example those set by a QA. | Language |
14 | TMX or extended properties. | Segment |
PROPERTIES
The JSON object has these properties:
name | Internal name of the layout. Can be disregarded. | string |
columns | An array of ordered columns. Each column is a JSON object and contains the "fkey" property. This property uniquely identifies the data of the column (such as a translation in a specific language). For all properties see below. | object[] |
Each column has these properties:
fkey | Uniquely identifies the content of the column. When querying data you only need to include this property. All other properties below are for information purposes only. The format is:
CODE
Examples:
CODE
| string |
Properties for information only: | ||
ftype | The type of the column. It is embedded inside "fkey". | int |
loc | The language code for the column. Some columns do not require a language and others do. There are two means to specific languages: a) Explicit language codes: "en", "fr-FR" ... b) Language indexes: "#0", "#1", .... The system then replaces "#0" with the first language in the scope, "#1" with the second one ... Language indexes can be used to work with generic layouts that can dynamically "adapt" to scopes. For example you could use a job layout that specifies two columns. One with the first language (source language) and another with the second language (first target language). | string |
canEdit | If false then this column is not editable by the user. Note that this is a general access right. You need to look at the access rights details sent back with each segment. | bool |
fqualifier | Used with certain data columns such as custom fields and labels. This then describes the CF or label ID. 0 if not applicable to field type. | int |
EXAMPLES
A layout for querying data. Note that you only need to specify the "fkey" properties:
{
"columns": [
{
"fkey": "1~en~0"
},
{
"fkey": "1~fr~0"
},
{
"fkey": "1~es~0"
},
{
"fkey": "6~fr~0"
},
{
"fkey": "13~fr~0"
},
{
"fkey": "12~es~0"
}
]
}
A layout using language indexes instead of codes:
{
"columns": [
{
"fkey": "1~#0~0"
},
{
"fkey": "1~#1~0"
}
]
}