This endpoint allows you creating new internationalization keys and translations. Check importOptions
section to
learn more about possibilities. If you use this endpoint, note that it requires authorization.
POST Endpoint
https://api.simplelocalize.io/api/v1/translations
Example cURL
curl
--location
--request POST 'https://api.simplelocalize.io/api/v1/translations' \
--header 'X-SimpleLocalize-Token: <API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"content": [
{
"key": "EXAMPLE_KEY",
"language": "en",
"text": "example text"
},
{
"key": "SALE",
"language": "pl",
"text": "Sprzedaż"
}
]
}'
Example successful response
{
"msg": "OK",
"status": 200,
"data": {
"uniqueKeysProcessed": 2,
"processedWithWarnings": false,
"message": "OK"
}
}
Available import options
Use query param 'importOptions' to do invoke custom logic after or during the import. You can pass more than one import option.
importOptions | Description |
---|---|
REPLACE_TRANSLATION_IF_FOUND |
Replaces translation for key if the key already exists. Without this option SimpleLocalize will only add new translations. |
PUBLISH_AFTER_IMPORT |
Translations will be published automatically to the CDN after successful import. Option available only in paid plans. Check also how to publish translations using API endpoint |
If you need more import options let us know: [email protected]