Translation Caching
Lingo.dev now includes a powerful caching mechanism for translations as they are received from the localization engine. This feature ensures reliability and efficiency, especially in scenarios with unstable network connections.
Why Translation Caching?
When running large translation jobs, network issues can be a significant concern:
- Connection Reliability: Flaky connections can interrupt long-running translation jobs
- Cost Efficiency: Without caching, interrupted jobs would need to restart from scratch
- Time Savings: Cached translations allow for immediate recovery from failures
- Resource Optimization: No need to retranslate content that was already processed
How It Works
The translation caching system works automatically in the background:
- As translations are received from the localization engine, they are immediately cached
- If a translation job fails (e.g., due to network issues), the cached translations are preserved
- When you re-run the
i18n
command, Lingo.dev initializes your buckets from the cache - Only remaining untranslated content needs to be processed
Example Scenario
Let's say you're translating a large documentation project:
bash
# Initial translation attempt
npx lingo.dev@latest i18n
# Connection fails at 80% completion
# Previous behavior: All progress would be lost
# With caching: Re-run the command
npx lingo.dev@latest i18n
# Lingo.dev will:
# 1. Load cached translations (80% complete)
# 2. Continue from where it left off
Best Practices
- Always Re-run After Failures: If a translation job fails, simply re-run the
i18n
command - Check Progress: Monitor the translation progress to ensure completion
- Verify Results: After completion, review your translation files to ensure everything is in place
Technical Details
- Caching is automatic and requires no additional configuration
- Cached translations are stored securely and persist between runs
- The system maintains consistency with your source content
- Cache is automatically invalidated when source content changes
This caching mechanism ensures that your translation workflow remains efficient and resilient, even in challenging network conditions. It's particularly valuable for teams working with:
- Large translation jobs
- Unstable internet connections
- Time-sensitive localization needs
- Cost-conscious translation budgets