Supported Formats
JSON
.json files with flat or nested structuresYAML
.yaml and .yml files with nesting supportGettext
.po files with msgid/msgstr entriesJSON Format
Flat Structure
The simplest format - direct key-value pairs:en.json
Nested Structure
i18n Doctor automatically flattens nested objects using dot notation:Nested structures are flattened only for analysis. Your original file structure remains unchanged.
Arrays in JSON
Arrays are flattened using numeric indices:Primitive Values
JSON supports strings, numbers, and booleans:config.json
Flattened
Primitive values (numbers, booleans) are converted to strings during parsing for consistent comparison across locales.
YAML Format
Basic YAML
YAML files use indentation to define structure:en.yml
Nested YAML
Supports parent-child relationships:YAML Comments
Comments are ignored during parsing:en.yml
Quoted Strings
Both single and double quotes are supported:en.yml
Gettext (.po) Format
Gettext is the standard for internationalization in many frameworks (Django, WordPress, etc.).Basic .po Structure
messages.po
Multi-line Strings
Gettext supports string continuation:messages.po
Empty Translations
Emptymsgstr values are treated as untranslated:
fr.po
Metadata Comments
Gettext comments and metadata are ignored:messages.po
msgid and msgstr are extracted for analysis.
Format Detection
i18n Doctor automatically detects format based on file extension:| Extension | Format | Parser |
|---|---|---|
.json | JSON | JSON.parse() with flattening |
.yaml, .yml | YAML | Lightweight YAML parser |
.po | Gettext | msgid/msgstr extractor |
Format detection is automatic. Just ensure your files use standard extensions.
Common Patterns
React i18next
Typically uses nested JSON:public/locales/en/translation.json
Vue i18n
Supports both JSON and YAML:Next.js with next-intl
Nested JSON inmessages/ directory:
messages/en.json
Django gettext
Standard .po files:locale/fr/LC_MESSAGES/django.po
Limitations
JSON: Extremely deep nesting
JSON: Extremely deep nesting
While i18n Doctor supports unlimited nesting depth, extremely deep structures (10+ levels) may create very long flattened keys. Consider refactoring for better organization.
YAML: Limited to standard syntax
YAML: Limited to standard syntax
The YAML parser is lightweight and supports common patterns. Advanced YAML features (anchors, tags, multi-doc files) are not supported. Use standard key-value structures.
Gettext: Single-file only
Gettext: Single-file only
Each .po file is processed independently. If your project uses domain-specific .po files (e.g.,
django.po, messages.po), each will be analyzed separately.Binary formats not supported
Binary formats not supported
Compiled formats like .mo (compiled gettext) are not supported. Use source .po files instead.
File Detection
i18n Doctor scans your repository for locale files in common locations:locales/i18n/public/locales/messages/locale/translations/lang/
**/*.json**/*.yaml,**/*.yml**/*.po
Next Steps
Understanding Reports
Learn how to interpret your scan results
Lingo.dev Integration
Fix missing translations with AI-powered translation