Translate missing entries in
.pofiles using DeepL — and detect duplicates for better translation memory management.
tpo-deepl is a CLI tool for modern gettext-based i18n workflows. It combines:
- ✅ DeepL-based auto-translation for missing
msgstrentries. - ✅ Advanced duplicate detection to identify redundant or overly similar translations.
- ✅ Designed for localization teams who want automation without sacrificing quality.
Install globally using pnpm:
pnpm install -g tpo-deeplSign up at deepl.com/pro — free up to 500,000 characters/month.
You can either:
# .env file:
DEEPL_API_KEY=your-key-hereor export it directly:
export DEEPL_API_KEY=your-key-hereIn your project root, create tpo.config.json or tpo.config.ts:
{
"localesPath": "./src/locales/{locale}/messages.po",
"mainLanguage": "de"
}- Use
{locale}placeholder where the language codes are located. - Make sure your file paths point to valid
.pofiles.
Auto-translate all missing .po entries using DeepL.
tpo translate [options]| Option | Description |
|---|---|
--dry-run |
Preview translations without modifying files |
--formality <level> |
DeepL formality: less, more, prefer_less, prefer_more, default |
--only <lang> |
Translate only specific language (e.g. fr) |
--silent |
Suppress output |
--config <path> |
Use a custom config file instead of default |
Translate all missing entries with formal tone:
tpo translate --formality moreTranslate only French:
tpo translate --only frPreview changes without modifying files:
tpo translate --dry-runDetect duplicate translations inside your .po files.
tpo duplicates [options]By default, detects strict identical msgstr duplicates per language file.
| Option | Description |
|---|---|
--words <number> |
Minimum consecutive words to match |
--similarity <number> |
Allow small gaps inside consecutive matches (only with --words) |
--only <lang> |
Limit scan to specific language |
--strict |
Fail with non-zero exit code if duplicates are found (CI friendly) |
Detect strict duplicates (default):
tpo duplicatesDetect duplicates with at least 3 consecutive identical words:
tpo duplicates --words 3Detect duplicates allowing 1 mismatch inside a 3-word sequence:
tpo duplicates --words 3 --similarity 1Limit detection to German:
tpo duplicates --only deMIT