Skip to content

Machine translations and review ​

Every stored translation knows who made it: a provider (a machine translation) or a person (written with setTranslate(), imported, or approved). Providers only fill what is empty, so they never overwrite a person's text.

In files ​

Formats that can say "needs review" say it:

FormatMachine translationA person's
PO#, fuzzyno flag
XLIFF 1.2state="needs-review-translation"translated, final, signed-off
XLIFF 2.0state="translated"reviewed, final
String Catalogneeds_reviewtranslated

On export a provider's text gets the mark. A translator reviews the file in their editor (Poedit, Xcode, an XLIFF tool) and clears the marks of what they checked; when the file is imported back, a cleared mark approves the text, and a corrected text replaces the machine one. The mark of the file decides over the import mode.

JSON, PHP arrays, YAML and Android resources have no place for a mark: review their machine translations before you commit them, or approve them in code.

Importing ​

importTranslations() takes a mode for texts a file leaves unmarked:

ImportModeImported texts become
Manual (default)a person's, all of them — importing approves
Changesa person's where they differ from the stored text; the same text keeps who made it
Machinemachine translations (another tool's); a person's stay

Changes is the mode for a file the translator wrote itself and someone edited: only the edits become a person's.

In code ​

php
// approve what a person checked: the texts stay, they become a person's
$translator->approveMachineTranslations(null, 'ru');          // every message
$translator->approveMachineTranslations($groupId, 'ru');      // one message

// drop machine translations to have them made again (a better provider, say); a person's stay
$translator->deleteMachineTranslations(null, 'ru');

getTranslates() shows each translation of a message with machine: true or false.