guides

Segments and locks

Read a project's segments with their translation status and lock state, lock or unlock them, and read or add the comments on them, as in the editor.

List segments

List Project Segments returns the segments of a project, one page at a time, in file order.

ParameterWhat it does
workUnitUuidOnly the segments of this work unit. It must belong to the project, otherwise the call fails with 404.
stepLevelOnly the work units at this workflow step: 1 is the first step. Must be 1 or more.
(neither)The segments of the last workflow step of each file.
includeFindingsAdds each segment's quality findings (issues and smells). false by default.
page, pageSizeThe page to return, from 0, and its size: 20 by default.

workUnitUuid and stepLevel can be combined. The answer gives the segments in content, with totalElements and totalPages to page through the rest.

Some older projects return an empty page: their segments are not available through this endpoint.

What a segment tells you

FieldMeaning
idThe segment id. It is the bwx:ts-id of the matching <trans-unit> in an exported XLIFF file.
workUnitUuid, stepLevelThe work unit the segment belongs to and its workflow step.
indexThe segment's position in its file, from 0.
source, targetThe source text and the current translation.
statusNOT_TRANSLATED, TRANSLATED (has a translation that is not confirmed), CONFIRMED, or REVIEWED.
lockedWhether the segment is locked.
confidenceScoreThe confidence score of the translation, when there is one.

Locked segments

A locked segment cannot be changed in the editor, and an import skips it without an error. Segments are locked by a person in the editor, or automatically by the project's settings (for example for exact translation memory matches). Locking a segment in the editor also confirms it.

Each workflow step has its own copy of the file's segments, so a segment can be locked at one step and not at another: read the work unit you are going to change.

In the bilingual XLIFF file, every <trans-unit> has bwx:locked and bwx:confirmed (yes or no), and a locked one also has translate="no". By default an import never changes a locked segment, whatever the file says. Import with applyStatusFromFile to lock, unlock, confirm and unconfirm segments from those attributes; see Bilingual file round trip.

Lock and unlock segments

Lock or Unlock Segments locks or unlocks segments of one work unit, as the editor's lock button does:

{
  "segmentIds": ["<segment id>", "<segment id>"],
  "locked": true
}

Comments

Segments have the same comments as the editor's comments panel. A comment belongs to the segment's position in the file (fileIndex), so every workflow step of the file shares it.

In the bilingual XLIFF file, a segment's comments are <note> elements of its <trans-unit>, with their author (from) and creation time in UTC (bwx:date). An import with applyStatusFromFile adds the notes a segment does not have yet as comments; without it, notes are ignored.