Write translations of a language
curl --request PUT \
--url https://api.tolk.every-day.io/v1/translations/{locale} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"translations": [
{
"hash": "<string>",
"value": "<string>",
"forms": {},
"version": 123
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tolk.every-day.io/v1/translations/{locale}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'translations' => [
[
'hash' => '<string>',
'value' => '<string>',
'forms' => [
],
'version' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({translations: [{hash: '<string>', value: '<string>', forms: {}, version: 123}]})
};
fetch('https://api.tolk.every-day.io/v1/translations/{locale}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"updated": 123,
"cleared": 123,
"unchanged": 123,
"skipped": [
{
"hash": "<string>",
"reason": "unknown",
"currentVersion": 123
}
],
"issues": [
{
"hash": "<string>",
"rules": [
"laravel.missing"
]
}
]
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"reason": "source_language_change"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Translations
Write translations of a language
Writes at most one block of translations of a target language, overwriting (overwrite) or only filling empty
ones (fill_empty). An empty value clears a translation; version refuses the item when the translation
changed since it was read. Items that are not written come back in skipped with the reason; placeholder errors
do not block a write and come back in issues. The source language is not writable: its texts change through
POST /keys/sync.
PUT
/
translations
/
{locale}
Write translations of a language
curl --request PUT \
--url https://api.tolk.every-day.io/v1/translations/{locale} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"translations": [
{
"hash": "<string>",
"value": "<string>",
"forms": {},
"version": 123
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tolk.every-day.io/v1/translations/{locale}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'translations' => [
[
'hash' => '<string>',
'value' => '<string>',
'forms' => [
],
'version' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({translations: [{hash: '<string>', value: '<string>', forms: {}, version: 123}]})
};
fetch('https://api.tolk.every-day.io/v1/translations/{locale}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"updated": 123,
"cleared": 123,
"unchanged": 123,
"skipped": [
{
"hash": "<string>",
"reason": "unknown",
"currentVersion": 123
}
],
"issues": [
{
"hash": "<string>",
"rules": [
"laravel.missing"
]
}
]
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"reason": "source_language_change"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
How a block writer treats a translation that already has text.
overwrite Replaces the text, or clears it with an empty text. |
fill_empty Only writes empty or missing translations; one with text is skipped. |
Available options:
overwrite, fill_empty Required array length:
1 - 1000 elementsShow child attributes
Show child attributes
Response
Show child attributes
Show child attributes