Retranslation
Lingo.dev CLI automatically retranslates content when source text changes, and provides manual retranslation options when you need to refresh translations for other reasons.
The CLI's content fingerprinting system ensures translations stay synchronized with source changes while avoiding unnecessary retranslation of unchanged content.
Automatic Retranslation
When you modify source content, Lingo.dev CLI detects the change through content fingerprinting and retranslates affected keys during the next run.
Example workflow:
// locales/en.json (original)
{
"button.save": "Save changes"
}
// locales/es.json (generated)
{
"button.save": "Guardar cambios"
}
After updating the source:
// locales/en.json (modified)
{
"button.save": "Save all changes"
}
Running npx lingo.dev@latest i18n
retranslates the Spanish version:
// locales/es.json (updated)
{
"button.save": "Guardar todos los cambios"
}
The CLI compares the new content fingerprint against i18n.lock
and identifies which translations need updating.
Manual Retranslation
Sometimes you need to retranslate content even when the source hasn't changed. This happens when you update AI models, change translation prompts, or want to refresh translations with improved context.
Complete Retranslation
Force complete retranslation:
npx lingo.dev@latest i18n --force
This bypasses the lockfile and retranslates all content, recreating the i18n.lock
file from scratch.
Targeted Retranslation
Target specific languages:
npx lingo.dev@latest i18n --locale es
Retranslates only Spanish content while preserving other languages.
Target specific file types:
npx lingo.dev@latest i18n --bucket json
Retranslates only JSON files, useful when different file types have different update frequencies.
Target specific translation keys:
npx lingo.dev@latest i18n --key welcome.title
Retranslates a single key across all target languages. For nested keys, use dot notation:
npx lingo.dev@latest i18n --key header.navigation.about
Target specific files:
npx lingo.dev@latest i18n --file blog.[locale].json
Retranslates specific files within your buckets. You can target multiple files:
npx lingo.dev@latest i18n --file landing.[locale].json --file pricing.[locale].json
Combining Options
You can combine targeting options for precise control:
npx lingo.dev@latest i18n --force --bucket json --locale es
This retranslates all JSON content, but only for Spanish.
Translation Context Updates
When you modify your AI translation settings, existing translations don't automatically update. You need manual retranslation to apply new prompts or models to previously translated content.
Common scenarios requiring retranslation:
- Switching from one AI model to another
- Updating translation prompts for better context
- Moving from raw LLM APIs to Lingo.dev Engine
- Improving terminology consistency across existing translations when using raw LLM APIs
Lockfile Integration
Retranslation updates the i18n.lock
file with new content fingerprints. This ensures future runs correctly track which content has been processed under the current translation settings.
The lockfile prevents retranslation loops and maintains the performance benefits of incremental translation even after manual retranslation operations.