Translation key drift guard
Using English strings as translation keys is convenient until someone edits the English. The key no longer matches, every locale falls through to the key, and the page renders in English with no error, no warning and no failing test. The regression is invisible until a native speaker notices.
CATEGORY
International SEO
FORMAT
translation-key-drift-guard.md
WHEN TO REACH FOR THIS
Use on any site whose translation keys are the English source text, where editing a headline silently reverts every other language.
The skill file
translation-key-drift-guard.md
---
name: translation-key-drift-guard
description: Use on any site whose translation keys are the English source text, where editing a headline silently reverts every other language.
---
# Translation key drift guard
Using English strings as translation keys is convenient until someone edits the English. The key no longer matches, every locale falls through to the key, and the page renders in English with no error, no warning and no failing test. The regression is invisible until a native speaker notices.
## What you need first
- The source tree containing the translation calls
- The locale files
## Method
1. Extract every literal passed to the translation function across templates and application code, handling both quote styles.
2. Compare that set against the keys present in each locale file. Anything in the source but missing from a locale is a string that will silently render in English.
3. Check placeholder parity in both directions: a key containing a named placeholder whose translation has dropped it produces a broken sentence at runtime, not an error.
4. Report keys present in a locale but absent from the source as orphans - safe to prune, and a signal that an English string was edited.
5. Wire the check into the release path so it exits non-zero. A check that nobody runs is not a check.
6. Prove it fails: delete one key and confirm the run breaks, then restore. An assertion never seen to fail is not trusted.
## What this produces
A per-locale report of missing keys, placeholder mismatches and orphans, with a non-zero exit that can gate a deploy.
## Where this goes wrong
- Building the check but never verifying it actually fails on a real regression
- Ignoring placeholder parity, which breaks sentences rather than merely reverting them
- Treating orphaned keys as noise when they are usually evidence that English copy was edited without updating the locales
---
From the QuQi skill library - https://www.quqi.io/skills/translation-key-drift-guard
Free to download · no account, no email
What you need first
-
The source tree containing the translation calls
-
The locale files
Method
-
01
Extract every literal passed to the translation function across templates and application code, handling both quote styles.
-
02
Compare that set against the keys present in each locale file. Anything in the source but missing from a locale is a string that will silently render in English.
-
03
Check placeholder parity in both directions: a key containing a named placeholder whose translation has dropped it produces a broken sentence at runtime, not an error.
-
04
Report keys present in a locale but absent from the source as orphans - safe to prune, and a signal that an English string was edited.
-
05
Wire the check into the release path so it exits non-zero. A check that nobody runs is not a check.
-
06
Prove it fails: delete one key and confirm the run breaks, then restore. An assertion never seen to fail is not trusted.
What this produces
A per-locale report of missing keys, placeholder mismatches and orphans, with a non-zero exit that can gate a deploy.
Where this goes wrong
-
Building the check but never verifying it actually fails on a real regression
-
Ignoring placeholder parity, which breaks sentences rather than merely reverting them
-
Treating orphaned keys as noise when they are usually evidence that English copy was edited without updating the locales
More in International SEO