We’re excited to announce that the keep_translations
parameter, previously available only when uploading a new source file, is now supported when editing individual source strings via the API!
What’s new
Until now, the keep_translations
option could only be used with the POST /resource_strings_async_uploads
endpoint when uploading or replacing source files.
Now, with this update, you can also set keep_translations
when editing a specific source string via the PATCH /resource_strings/{resource_string_id}
endpoint.
This means you can decide whether to preserve or discard existing translations for a specific string when editing its source text directly through the API.
Behavior of keep_translations
-
keep_translations=true
(default):
Transifex keeps existing translations even if the source string is modified.-
Translations remain visible in the Editor.
-
A Translation Memory ™ entry is created linking the updated source text with the existing translations.
-
History will show both the source edit and a new translation action under the same timestamp.
-
-
keep_translations=false
:
Transifex removes existing translations when the source string is modified.-
Translations are cleared from the Editor (but preserved in TM).
-
The source string will appear as untranslated in all target languages.
-
This is useful when a change in the source text makes previous translations invalid.
-
Example: Editing a Source String via API
You can now use the PATCH
method to update a single source string with or without keeping its translations.
curl --request PATCH \
--url https://rest.api.transifex.com/resource_strings/resource_string_id \
--header 'accept: application/vnd.api+json' \
--header 'content-type: application/vnd.api+json' \
--data '
{
"data": {
"attributes": {
"character_limit": 100,
"instructions": "Please use casual language for translations.",
"keep_translations": false,
"strings": {
"one": "hello",
"other": "world"
},
"tags": [
"foo",
"bar"
]
},
"id": "o:organization_slug:p:project_slug:r:resource_slug:s:2e354ef120752c67afa1b6855aa80c52",
"type": "resource_strings"
}
}
'
Try it out!
You can start using this new parameter today to fine-tune how your translations are handled when editing source content via the API.
We’d love to hear your feedback — let us know how this improvement helps streamline your workflow!