Save a translation
Saves the translation of a form into one language: its texts (form) and messages (messages), in the format of Languages. Needs the forms:write scope and editor access to the form.
https://api.responsly.com/v1/forms/{form_id}/translations/{lang_code} lang_code is a language code such as pl, de or zh-TW.
To add a language, start from its translation template: every text of the form in this shape, ready to translate.
Save over the version you read
Section titled “Save over the version you read”A language that already exists is saved only over the version you read: send its version from Get translations or the template in the If-Match header. If the translation has changed since, nothing is saved and the answer is 412. Without If-Match the answer is 428.
A new language is sent without If-Match. A version of a language that was removed since you read it gives 412, so a removed language never comes back by accident.
Example
Section titled “Example”curl -X PUT https://api.responsly.com/v1/forms/Dg8Lz5ep/translations/pl \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -H 'If-Match: "9c2e4b7a1f0d3e6c8b5a2f9e7d4c1b0a3e6f9c2d5b8a1e4d7c0f3b6a9e2d5c8"' \ -d '{"form": [{"ref": "q1", "type": "opinion_scale", "title": "Jak bardzo polecił(a)byś nas znajomym?"}], "messages": {"next": "Dalej"}}'The response is the saved language, in the shape of one item of Get translations, with its new version: 200 for a language that existed, 201 for a new one.
What the body must look like
Section titled “What the body must look like”The body replaces the whole language, so it has both fields:
form: a list with one item per translated part of the form (welcome page, question, group, end page). Each item has therefandtypeof its part.propertiesis an object;choicesandquestionsare lists whose entries have therefof the answer or row they translate. The form finds each part by itsref.messages: an object of the form’s messages by key, such as{"next": "Dalej"}. It may be empty.
A text you leave out is saved empty, and the form shows its own language there. A body of another shape is refused with 422, because the form could not be shown in that language.
Errors
Section titled “Errors”| Status | Meaning |
|---|---|
403 | The token lacks forms:write, or the form belongs to another team or a workspace you cannot edit. |
412 | The translation has changed since the version in If-Match, it was removed since, a new language was added by someone else in the meantime, or the form was moved to another workspace or deleted. Nothing was saved. |
422 | The translation is not valid. The answer lists the problems. |
428 | The language exists and If-Match is missing. |