agent failed to dedupe string catalog collapsing distinct keys with same english text
Covers agents collapsing distinct keys with identical English: dedupe by key, restore the entries, add context notes. Use it when contexts got merged. Not for true duplicates.
Fix the agent collapsing distinct keys that share English text
TL;DR
The agent dedupes by English text, but different keys with the same wording are different strings, so dedupe by key instead. Same English in two contexts often needs different translations. Turn off text-based deduping, keep key-based identity, and restore the collapsed keys.
The error
Agent deduped 30 keys into 12 because the English matched
"Save" as a button and "Save" as a menu item became one key, translations brokeFix it
Step 1: Find the collapsed keys
node -e "console.log('diff the catalog against the previous version, look for keys that vanished while their text survives elsewhere')"Expected: You see which keys were merged.
Step 2: Disable text-based deduping in the agent
grep -n "dedupe\|deduplicate" scripts/agent-config.js | head -5Expected: You find the dedupe setting to switch to key-based.
Step 3: Restore the collapsed keys
node -e "console.log('re-add each removed key with its own entry, even if the English duplicates another')"Expected: Every key is back as its own entry.
Step 4: Add context notes so translators disambiguate
node -e "console.log('add a note to each duplicate-English key naming its UI location')"Expected: Translators can tell the contexts apart.
When to use this
- An agent merged distinct keys with identical English text
- Translations broke because contexts were collapsed
When NOT to use this
- The keys are truly duplicates in the same context, then merging is fine
- English differs but translations collide, that is a translator issue
Tool and version compatibility
- Any agent or tool with catalog deduping
- Key-based identity for catalog entries
Variant phrasings
dedupe by text plus context
Better than text alone, but key-based is still the safe rule. Context matching is fuzzy.
intentional shared keys across the app
Then share one key deliberately in code. Do not rely on the agent to merge them.
Why it happens
Dedupe-by-text assumes identical source means identical meaning, which is false across UI contexts. A verb here and a noun there share spelling but need different translations, and merging them forces one translation onto both.
Edge cases
- Add a CI check that fails when two keys merge unexpectedly
- Some TMS platforms dedupe on import too, check their settings as well
- Document which keys intentionally share text so future agents do not re-merge
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_nedJZTNWGFrMoKnBO13vgg