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:
{ "columns": [ { "fkey": "1~en~0" }, { "fkey": "1~fr~0" } ] }
Column identifier "fkey"
Each data column is uniquely identified by a string ("fkey"). When requesting data you need to specify the "fkey" values you want to obtain.
You can construct the "fkey" by hand or use an API to retrieve a list of all the available "fkey" values. This list depends on the access rights of the current user.
The format is:
{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 | Requires language |
---|---|---|
1 | The source text or target text of a segment. | Yes |
2 | Context of the segment. | No |
3 | Status of a text. | Yes |
4 | Origin of current text version: Human translation, pretranslation, etc. | Yes |
5 | Locked status | Yes |
6 | Bookmark | Yes |
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. | Yes/No |
8 | Label. Requires specification of "fqualifier" in the "fkey". This is the ID of the label. | No |
9 | Comments | Yes |
10 | Memory hits. NOT IMPLEMENTED. | Yes |
11 | A column that allows a user to add a new comment. For internal use only. | Yes |
12 | Revisions | Yes |
13 | Error. For example those set by a QA. | Yes |
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: {ftype}~{loc}~{fqualifier}
Examples: 1~en~0 // The English text 8~~12 // The label with ID 12 (no language required) 3~fr~0 // The status of the French translation 1~#1~0 // The text in the 2nd language of the scope | 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 with 2 languages and full details:
{ "name": null, "columns": [ { "ftype": 1, "loc": "en", "canEdit": true, "fqualifier": 0, "fkey": "1~en~0" }, { "ftype": 1, "loc": "fr", "canEdit": true, "fqualifier": 0, "fkey": "1~fr~0" }, { "ftype": 1, "loc": "es", "canEdit": true, "fqualifier": 0, "fkey": "1~es~0" }, { "ftype": 6, "loc": "fr", "canEdit": true, "fqualifier": 0, "fkey": "6~fr~0" }, { "ftype": 13, "loc": "fr", "canEdit": true, "fqualifier": 0, "fkey": "13~fr~0" }, { "ftype": 12, "loc": "es", "canEdit": false, "fqualifier": 0, "fkey": "12~es~0" } ] }
A layout that uses language indexes instead of actual codes:
{ "name": null, "columns": [ { "ftype": 1, "loc": "#0", "canEdit": true, "fqualifier": 0, "fkey": "1~#0~0" }, { "ftype": 1, "loc": "#1", "canEdit": true, "fqualifier": 0, "fkey": "1~#1~0" }, { "ftype": 1, "loc": "#2", "canEdit": true, "fqualifier": 0, "fkey": "1~#2~0" }, { "ftype": 6, "loc": "#1", "canEdit": true, "fqualifier": 0, "fkey": "6~#1~0" }, { "ftype": 13, "loc": "#1", "canEdit": true, "fqualifier": 0, "fkey": "13~#1~0" }, { "ftype": 12, "loc": "#2", "canEdit": false, "fqualifier": 0, "fkey": "12~#2~0" } ] }