Translation Doctor
VS Code extension to audit i18n usage.
What it checks
- String literals in code that look user-facing and are not wrapped in translation functions.
- Translation keys used in code (e.g.
t('home.title')) that are missing from translation JSON files.
- Translation keys that exist but have empty values (
"", null, or undefined) in language files.
Markdown Report
After each scan, the extension writes translation-report.md in the workspace root.
The report includes:
- Pages/files grouped by path.
- Exact line number for each used key.
- Missing languages for each key.
- Languages where the key exists but has an empty value.
Project Config File
On first activation, the extension creates a project config file at .translation-doctor.json in the workspace root.
This file contains all required scan settings:
languages
translationFilePattern
sourceIncludeGlob
sourceExcludeGlob
translationFunctions
minLiteralLength
Translation Doctor: Configure updates this file directly.
Commands
Translation Doctor: Configure
Translation Doctor: Scan Workspace
Configuration
translationDoctor.languages
translationDoctor.translationRootDir (e.g. i18n, scans i18n/{lang}/**/*.json)
translationDoctor.translationFilePattern (supports {lang} placeholder)
translationDoctor.sourceIncludeGlob
translationDoctor.sourceExcludeGlob
translationDoctor.translationFunctions
translationDoctor.minLiteralLength
If translationDoctor.translationRootDir is set, it takes priority over translationDoctor.translationFilePattern.
Supported Translation Structures
- Single file per language:
{
"translationFilePattern": "i18n/{lang}.json",
"languages": ["en", "ar"]
}
- Folder per language (many files):
{
"translationFilePattern": "i18n/{lang}/**/*.{json,ts,js}",
"languages": ["en", "ar"]
}
i18n/index.ts that imports language trees (./en, ./ar, etc.):
{
"translationFilePattern": "i18n/index.ts",
"languages": ["en", "ar"]
}
The scanner now supports both JSON and TypeScript/JavaScript translation sources.