How Auto-Detection Works
The scanner uses pattern matching to identify translation files within your repository’s file tree. It recognizes common i18n directory structures and file naming conventions used across popular frameworks and libraries.Supported Directory Patterns
The scanner searches for translation files in these common directory locations:Root-level directories
locales/orlocale/i18n/lang/orlanguages/translations/messages/
Framework-specific paths
public/locales/orpublic/locale/public/i18n/src/locales/orsrc/locale/src/i18n/,src/lang/,src/messages/,src/translations/app/i18n/assets/i18n/orassets/locales/
The scanner examines up to 4 directory levels deep to find matching patterns. For example, it will detect
src/app/i18n/locales/.Locale Code Detection
Locale codes are identified using BCP-47 style patterns:- Two-letter language codes:
en,fr,es,de,ja,zh - Language + region codes:
en-US,pt-BR,zh-CN,fr-CA - Underscore variants:
en_US,pt_BR(automatically normalized to hyphen format)
Supported File Formats
i18n Doctor recognizes three popular translation file formats:JSON (.json)
JSON (.json)
The most common format for web applications. Supports nested objects that are flattened into dot-notation keys.Example structure:Flattened keys:
common.welcomecommon.goodbyeerrors.not_found
YAML (.yaml, .yml)
YAML (.yaml, .yml)
Popular in Ruby on Rails and other backend frameworks. Supports flat and nested structures.Example structure:The scanner handles both quoted and unquoted values, and automatically strips comments.
Gettext PO (.po)
Gettext PO (.po)
Traditional format used in PHP, Python, and many other ecosystems.Example structure:The scanner parses
msgid as the key and msgstr as the translated value.Directory Structure Styles
The scanner detects two organizational patterns:Flat Structure
Locale files are placed directly in the base directory, with the locale code as the filename:Detected as:
style: "flat"Best for: Simple projects with a single translation file per localeNested Structure
Each locale has its own subdirectory containing multiple translation files:Detected as:
style: "nested"Best for: Large projects with translations split across multiple namespacesSource Locale Detection
i18n Doctor automatically identifies which locale serves as the source (reference) for comparisons:- Prefers English: If
enoren-usexists, it’s selected as the source - Falls back to first alphabetically: If no English locale is found, the first locale alphabetically becomes the source
(source) badge.
Scanning Process
When you submit a repository URL, i18n Doctor executes these steps:Parse & Validate
Extracts the owner, repository name, and optional branch from the GitHub URL. Fetches repository metadata including the default branch if none is specified.
Fetch File Tree
Retrieves the complete file tree for the specified branch using the GitHub Trees API. This provides a list of all files and their paths without downloading content.
Detect Locale Files
Scans the file tree for translation files matching known patterns. Groups files by base directory and organizational style.
Download & Parse
Fetches the raw content of all detected translation files in parallel. Parses each file according to its format (JSON/YAML/PO) into a flat key-value map.
No Locale Files Found?
If the scanner reports “No locale files found”, check that:- Your translation files use supported extensions:
.json,.yaml,.yml, or.po - Files are located in one of the supported directory patterns
- Filenames or directory names match locale code patterns
- The repository is public (private repos are not supported)
Example: Next.js i18n Setup
Example: React i18next Setup
Rate Limits
GitHub API rate limits apply:- Unauthenticated requests: 60 requests per hour per IP
- Authenticated requests: 5,000 requests per hour (when
GITHUB_TOKENis configured)