This endpoint allows you to operate only on existing translations. Use this endpoint to update translation for given translation key and language or translation key, language and customer id. Using this endpoint requires authorization.
Deprecation notice: This endpoint will be deprecated in the future. Check the updated documentation instead.
Endpoint
PATCH
https://api.simplelocalize.io
/api/v1/translations
Sample request
curl
--location
--request PATCH 'https://api.simplelocalize.io/api/v1/translations' \
--header 'X-SimpleLocalize-Token: <API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"content": [
{
"key": "HELLO_WORLD",
"language": "en",
"text": "Hello world!"
},
{
"key": "HELLO_WORLD",
"language": "pl",
"text": "Witaj świecie!"
}
]
}'
Request fields
content
- array of objects with translation updates,key
- unique translation key for a project,language
- project language key,text
- translation text,namespace
- namespace for a translation key,customerId
- customer id for a translation key.
Response
{
"msg": "OK",
"status": 200,
"data": {
"numberOfUpdates": 2,
"numberOfFailures": 4,
"numberOfInserts": 1,
"failures": [
"Cannot update translation. Translation key value is empty.",
"Cannot update translation. Language value is empty for key 'MY_TRANSLATION_KEY'.",
"Cannot update translation. Language 'wrong-lang-key' does not exist in the project.",
"Cannot update translation. Translation key 'MY_TRANSLATION_KEY' does not exist in the project."
]
}
}
Response fields
numberOfUpdates
- informs about number of processed translation updates,numberOfFailures
- informs about number of processed translation update failures,numberOfInserts
- informs about number of newly added translations,failures
- informs about failed updates.
Available update options
Use query param 'updateOptions' to do invoke custom logic after or during the import. You can pass more than one update option.
updateOptions | Description |
---|---|
CREATE_KEY_IF_NOT_FOUND | Creates translation key which are not present in the project. |
Was this helpful?