Repository navigation
Allow single-row translation updates that include key and language - #28001
Merged
ComfortablyCoding merged 8 commits intoAug 4, 2026
Merged
ComfortablyCoding merged 8 commits into
ComfortablyCoding merged 8 commits into
Conversation
suhailopensource
force-pushed
the
fix/27986-translations-single-row-update
branch
from
July 29, 2026 15:56
1534692 to
ba64df6
Compare
ComfortablyCoding
requested changes
Jul 29, 2026
ComfortablyCoding
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR! See comments below
suhailopensource
force-pushed
the
fix/27986-translations-single-row-update
branch
from
July 29, 2026 16:31
93721a3 to
515279d
Compare
ComfortablyCoding
marked this pull request as draft
July 29, 2026 16:34
suhailopensource
marked this pull request as ready for review
July 29, 2026 17:05
ComfortablyCoding
previously requested changes
Jul 29, 2026
ComfortablyCoding
left a comment
Member
There was a problem hiding this comment.
Second pass review, see comments below.
- Fail fast on bulk updates that set both key and language, without a DB read - Exclude only the current row from the duplicate check instead of the whole batch
ComfortablyCoding
approved these changes
Aug 4, 2026
ComfortablyCoding
left a comment
Member
There was a problem hiding this comment.
LGTM! Thanks and congratulations on your first contribution to directus! 🥳
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #27986
Problem
TranslationsService.updateManyrejected legitimate single-row updates that included bothkeyandlanguage, returning a false400 Duplicate key and language combination. This blocked edits via REST/SDK/Studio and blocked sync/import tools sending the complete record.Root cause (
api/src/services/translations.ts)keys.length > 0, so it rejected every single-row update. A single row can't self-collide — only a multi-row update collapsing several rows onto the samekey+languageshould be rejected there.translationKeyExists()didn't exclude the row(s) being updated, so a resave carrying the row's ownkey+languagematched itself and reported a false duplicate.Fix
keys.length > 1.excludeKeysargument totranslationKeyExists()(.whereNotIn('id', excludeKeys)) and passed the ids being updated, so a row can't collide with itself.Tests
Added
api/src/services/translations.test.tscovering:key+languagenow succeeds (regression for TranslationsService.updateMany rejects any single-row update that includes bothkeyandlanguage#27986);key+languagealready owned by a different row is still rejected;key+languageis still rejected.The regression test fails with only the guard change and passes once the self-exclusion is added.
Notes
Per discussion on the issue, the Studio only sends changed fields on a resave, so the self-exclusion mainly matters for the import/sync path sending the full record — kept it in to cover that case.