scripts/front/verify-translations/README.md
Validates Strapi admin react-intl message descriptors against en.json and locale files.
# Full validation (exit 1 on errors)
yarn verify:translations
# Backfill missing en.json keys from defaultMessage, then reorder/prune locale orphans
yarn verify:translations --fix
# Scope to one package
yarn verify:translations --bundle=core/content-manager
--fix always closes en.json gaps before pruning locales. A key used in code with a
defaultMessage but missing from en.json is added first; only then are locale keys absent
from that catalog removed. That keeps translator work for live message ids.
| Check | Severity |
|---|---|
Static / finite-enum keys used in code exist in the correct en.json | error |
Cross-package core/admin keys referenced from plugins | error |
Locale keys exist in en.json and follow its relative order | error |
defaultMessage matches en.json (whitespace-normalized) | warning |
Yup/schema error.* / validation.* string literals exist in package en.json | error |
notification.* validation strings exist in core/admin en.json | error |
Extractions are classified automatically:
getTrad(`attribute.${type}`); expanded by matching the template pattern against en.json keyscontent-manager.content-types.${uid}.${field} etc.; require defaultMessage, not en.jsonformatMessage({ id: error }) from Yup; keys collected from schema literalsAdmin message namespaces (global., Settings., …) are derived from core/admin en.json — not a hand-maintained prefix list. Plugin message prefixes are derived from the package path (plugins/i18n → i18n; core/admin has none).
reorder-admin-translation-files.js — replaced by yarn verify:translations --fixadd-missing-keys-to-other-language.js — kept for explicit translator workflowsyarn verify:translations into CI once debt is burned downen.json values from defaultMessage and align call sites