{"repo": "ahvega/potranslate", "files": {"README.md": {"544618966f8d9a6a5149cebf1ba5891c29b1790a": {"t": 1785747280.8115678, "n": 22018, "h": "5fd1f83d18c4d4a6", "c": "# PO File Translator\n\n
\n\n![Python](https://img.shields.io/badge/Python-3.8+-3776AB?style=for-the-badge&logo=python&logoColor=white)\n![PowerShell](https://img.shields.io/badge/PowerShell-5.1+-5391FE?style=for-the-badge&logo=powershell&logoColor=white)\n![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)\n![Version](https://img.shields.io/badge/Version-2.0-blue?style=for-the-badge)\n\n[![DeepL](https://img.shields.io/badge/DeepL-API-0F2B46?style=for-the-badge&logo=deepl&logoColor=white)](https://www.deepl.com)\n[![Google Cloud](https://img.shields.io/badge/Google_Cloud-Translate-4285F4?style=for-the-badge&logo=google-cloud&logoColor=white)](https://cloud.google.com/translate)\n[![OpenAI](https://img.shields.io/badge/DeepSeek-API-412991?style=for-the-badge&logo=openai&logoColor=white)](https://www.deepseek.com)\n\n**A comprehensive tool for automating the translation of PO (Portable Object) files using multiple translation APIs with advanced performance optimizations.**\n\n[Features](#features) • [Installation](#installation) • [Usage](#usage) • [Documentation](#documentation) • [Performance](#performance-guide)\n\n
\n\n---\n\n## šŸ‘¤ Author\n\n**Adalberto H. Vega**\n\n[![GitHub](https://img.shields.io/badge/GitHub-Profile-181717?style=flat-square&logo=github)](https://github.com/yourusername)\n\n## šŸ“‹ Description\n\nThis project provides a complete suite of scripts to automate the translation of PO files commonly used in software localization, particularly for WordPress plugins and themes. It supports multiple translation APIs (DeepL, Google Cloud Translate, DeepSeek) with advanced features like batch processing, caching, parallel translation, and progress resumption.\n\n## ✨ Features\n\n### šŸŽÆ Core Features\n\n| Feature | Description | Status |\n|---------|-------------|--------|\n| 🌐 **Multi-API Support** | DeepL, Google Cloud Translate, and DeepSeek | āœ… |\n| šŸ¤– **Automated Translation** | Processes only untranslated entries in PO files | āœ… |\n| šŸ·ļø **HTML/Variable Preservation** | Maintains formatting, HTML tags, and variables (`%s`, `%d`, `{0}`) | āœ… |\n| šŸ“Š **Progress Tracking** | Real-time progress bars with tqdm | āœ… |\n| šŸ”„ **Error Handling** | Retry logic with exponential backoff | āœ… |\n| šŸ”Œ **WordPress Integration** | Scripts for POT/PO/MO file management with WP-CLI | āœ… |\n\n### ⚔ Performance Optimizations\n\n| Optimization | Benefit | Speedup |\n|--------------|---------|---------|\n| šŸ’¾ **Translation Caching** | Avoid re-translating identical strings | 80-95% faster |\n| šŸ“¦ **Batch Translation** | Process multiple strings in a single API call | 5-10x faster |\n| šŸ”€ **Parallel Processing** | Concurrent translation with configurable workers | 2-4x faster |\n| šŸ’æ **Progress Persistence** | Resume interrupted translations without losing work | Reliability |\n| šŸš€ **Compiled Regex Patterns** | Optimized HTML/variable detection | 20-30% faster |\n| 🧠 **Memory-Efficient** | Handle files with 100,000+ entries | Scalability |\n\n## šŸ“¦ Requirements\n\n### System Requirements\n\n![Python Version](https://img.shields.io/badge/Python-3.8+-blue?logo=python&logoColor=white)\n![PowerShell Version](https://img.shields.io/badge/PowerShell-5.1+-blue?logo=powershell&logoColor=white)\n![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)\n\n- Python 3.8+\n- PowerShell 5.1+ (for automation scripts)\n- Internet connection for API access\n\n### šŸ”‘ API Keys (choose one or more)\n\n\n\n\n\n\n\n
\n\"DeepL\"/
\nDeepL API Key
\nRecommended for quality\n
\n\"Google
\nGoogle Cloud Project
\nTranslation API enabled\n
\n\"DeepSeek\"/
\nDeepSeek API Key
\nCost-effective alternative\n
\n\n### šŸ“š Python Dependencies\n\n![polib](https://img.shields.io/badge/polib-1.2.0+-orange)\n![deepl](https://img.shields.io/badge/deepl-1.16.1+-blue)\n![python-dotenv](https://img.shields.io/badge/python--dotenv-1.0.0+-green)\n![tqdm](https://img.shields.io/badge/tqdm-4.66.1+-red)\n\n```python\npolib>=1.2.0 # PO file parsing\ndeepl>=1.16.1 # DeepL API client\npython-dotenv>=1.0.0 # Environment variables\ntqdm>=4.66.1 # Progress bars\nrequests # HTTP requests\nopenai # DeepSeek API client\ngoogle-cloud-translate # Google Cloud Translate v3\n```\n\n## šŸ”§ API Setup\n\n
\nšŸ”µ DeepL API Key\n\n1. **Create an Account**: Sign up at [DeepL.com](https://www.deepl.com)\n2. **Access API Keys**: Navigate to your account's 'API Keys' section\n3. **Create New Key**: Generate a new API key\n4. **Choose Plan**:\n - šŸ†“ **Free Plan**: 500,000 characters/month\n - šŸ’Ž **Pro Plan**: Unlimited translations with higher rate limits\n5. **Security**: Keep your API key confidential\n\nšŸ“– For more details: [DeepL API Documentation](https://developers.deepl.com/docs/getting-started/auth)\n\n
\n\n
\nšŸ”“ Google Cloud Translate\n\n1. **Create Project**: Go to [Google Cloud Console](https://console.cloud.google.com)\n2. **Enable API**: Enable the Cloud Translation API\n3. **Create Service Account**:\n - Go to IAM & Admin → Service Accounts\n - Create a new service account\n - Grant \"Cloud Translation API User\" role\n4. **Generate Key**: Download JSON key file\n5. **Save Key**: Store JSON file in project directory (gitignored)\n\n
\n\n
\n🟣 DeepSeek API Key\n\n1. **Sign Up**: Create account at [DeepSeek Platform](https://platform.deepseek.com)\n2. **Generate Key**: Navigate to API Keys section\n3. **Cost-Effective**: Lower pricing than DeepL/Google for high volumes\n\n
\n\n---\n\n## šŸš€ Installation\n\n### 1. Clone the Repository\n\n```powershell\ngit clone \ncd potranslate\n```\n\n### 2. Create Virtual Environment\n\n```powershell\npython -m venv .venv\n```\n\n### 3. Activate Virtual Environment\n\n```powershell\n# Windows PowerShell\n.\\.venv\\Scripts\\Activate.ps1\n\n# Windows CMD\n.venv\\Scripts\\activate.bat\n\n# Linux/Mac\nsource .venv/bin/activate\n```\n\n### 4. Install Dependencies\n\n```powershell\npip install -r requirements.txt\n```\n\n### 5. Configure Environment Variables\n\nCreate a `.env` file in the project root:\n\n```env\n# DeepL Configuration\nDEEPL_API_KEY=your-deepl-api-key-here\n\n# Google Cloud Configuration\nGOOGLE_CLOUD_PROJECT=your-project-id\nGOOGLE_APPLICATION_CREDENTIALS=path/to/service-account.json\n\n# DeepSeek Configuration\nDEEPSEEK_API_KEY=your-deepseek-api-key-here\n```\n\n**Note**: You only need to configure the API(s) you plan to use.\n\n## šŸ’» Usage\n\n### šŸŽ¬ Quick Start\n\n#### Basic Translation (Sequential)\n\n```bash\n# Using DeepL\npython translate-po-multiple.py input.po output.po --api deepl --target-lang es\n\n# Using Google Translate\npython translate-po-multiple.py input.po output.po --api google --target-lang es\n\n# Using DeepSeek\npython translate-po-multiple.py input.po output.po --api deepseek --target-lang es\n```\n\n#### ⚔ Optimized Translation (Recommended)\n\n```bash\n# DeepL with batch processing (5-10x faster)\npython translate-po-multiple.py input.po output.po --api deepl --batch-size 20\n\n# Google with larger batches (up to 100)\npython translate-po-multiple.py input.po output.po --api google --batch-size 50\n\n# DeepSeek with parallel processing (no batch support)\npython translate-po-multiple.py input.po output.po --api deepseek --parallel 4\n```\n\n#### šŸ“ Large File Translation (with resume capability)\n\n```bash\n# Start translation with progress tracking\npython translate-po-multiple.py large.po output.po --api deepl --batch-size 30 --resume\n\n# If interrupted, resume from where it left off\npython translate-po-multiple.py large.po output.po --api deepl --batch-size 30 --resume\n```\n\n### PowerShell Automation Scripts\n\n#### Direct Translation\n\n```powershell\n# Translate a PO file using the virtual environment wrapper\n.\\trans-po.ps1 -filename \"path\\to\\file.po\"\n```\n\n#### Download Folder Workflow\n\n```powershell\n# Process file from Downloads (for WordPress plugin translations)\n.\\process-po.ps1 -FilePrefix \"elementor-1142\"\n\n# Expects: elementor-1142-es.po in Downloads\n# Outputs: elementor-1142-es_ES.po back to Downloads\n```\n\n### WordPress Translation Workflow\n\n#### 1. Generate POT and PO Files\n\n```powershell\n# Create PO file for Spanish\n.\\make-po.ps1 es\n\n# Creates: languages/your-plugin-es_ES.po\n```\n\n#### 2. Translate the PO File\n\n```powershell\n# Translate using optimized batch processing\n.\\trans-po.ps1 -filename \"languages\\your-plugin-es_ES.po\"\n```\n\n#### 3. Compile to MO File\n\n```powershell\n# Compile for WordPress\n.\\make-mo.ps1 es\n\n# Creates: languages/your-plugin-es_ES.mo\n```\n\n### Advanced Options\n\n#### Command-Line Parameters\n\n```powershell\npython translate-po-multiple.py input.po output.po [OPTIONS]\n\nOptions:\n --api {deepl,deepseek,google} Translation API (default: deepl)\n --target-lang LANG Target language code (default: es)\n --batch-size SIZE Strings per batch (default: 10)\n --parallel WORKERS Parallel workers (default: 1)\n --no-cache Disable translation caching\n --resume Resume from previous progress\n --delay SECONDS Delay between translations (default: 0.5)\n```\n\n#### Example Configurations\n\n**Small Files (< 500 entries)**\n\n```powershell\npython translate-po-multiple.py input.po output.po --api deepl\n```\n\n**Medium Files (500-5000 entries)**\n\n```powershell\n# DeepL\npython translate-po-multiple.py input.po output.po --api deepl --batch-size 20\n\n# Google\npython translate-po-multiple.py input.po output.po --api google --batch-size 50\n```\n\n**Large Files (5000+ entries)**\n\n```powershell\n# DeepL with resume capability\npython translate-po-multiple.py input.po output.po \\\n --api deepl \\\n --batch-size 30 \\\n --resume\n\n# Google with maximum batch size\npython translate-po-multiple.py input.po output.po \\\n --api google \\\n --batch-size 100 \\\n --resume\n```\n\n**DeepSeek (no batch support)**\n\n```powershell\npython translate-po-multiple.py input.po output.po \\\n --api deepseek \\\n --parallel 3 \\\n --delay 0.3\n```\n\n**Development/Testing**\n\n```powershell\n# Force fresh translations without cache\npython translate-po-multiple.py test.po output.po \\\n --api deepl \\\n --no-cache \\\n --batch-size 5\n```\n\n## šŸ“Š Performance Guide\n\n### šŸš€ Expected Performance Improvements\n\n| File Size | Method | Time (Before) | Time (After) | Improvement |\n|-----------|--------|---------------|--------------|-------------|\n| 500 entries | Sequential | ā±ļø ~4 min | ⚔ ~45 sec | ![5.3x](https://img.shields.io/badge/5.3x-faster-brightgreen) |\n| 1000 entries | Batch (20) | ā±ļø ~8 min | ⚔ ~90 sec | ![5.3x](https://img.shields.io/badge/5.3x-faster-brightgreen) |\n| 5000 entries | Batch (50) | ā±ļø ~42 min | ⚔ ~5 min | ![8.4x](https://img.shields.io/badge/8.4x-faster-green) |\n| 10000 entries | Batch + Cache | ā±ļø ~84 min | ⚔ ~6 min | ![14x](https://img.shields.io/badge/14x-faster-success) |\n\n### šŸ’” Optimization Recommendations\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
āœ…Always use caching unless testing (enabled by default)
šŸ“¦Use batch translation for DeepL and Google (10-50x faster)
šŸ”€Use parallel processing for DeepSeek (2-4x faster)
šŸ’¾Enable resume for files > 1000 entries
ā²ļøAdjust delay if hitting rate limits
\n\n### šŸ’¾ Caching Benefits\n\n```mermaid\ngraph LR\n A[First run] -->|Normal speed| B[Cache built]\n B -->|50% new| C[~2x faster]\n B -->|100% cached| D[~50x faster ⚔]\n style D fill:#90EE90\n```\n\n- šŸ”„ **First run**: Normal speed, builds cache\n- ⚔ **Second run (50% new content)**: ~2x faster\n- šŸš€ **Re-translation (100% cached)**: ~50x faster (instant)\n\n## File Structure\n\n```\npotranslate/\nā”œā”€ā”€ translate-po.py # Original DeepL-only translator\nā”œā”€ā”€ translate-po-multiple.py # Multi-API translator with optimizations\nā”œā”€ā”€ trans-po.ps1 # Virtual environment wrapper\nā”œā”€ā”€ process-po.ps1 # Downloads folder workflow\nā”œā”€ā”€ make-po.ps1 # Generate POT/PO files (WP-CLI)\nā”œā”€ā”€ make-mo.ps1 # Compile MO files (WP-CLI)\nā”œā”€ā”€ requirements.txt # Python dependencies\nā”œā”€ā”€ .env # API keys (not committed)\nā”œā”€ā”€ .gitignore # Git ignore rules\nā”œā”€ā”€ README.md # This file\nā”œā”€ā”€ CLAUDE.md # Project instructions for Claude Code\nā”œā”€ā”€ OPTIMIZATION_GUIDE.md # Detailed optimization guide\nā”œā”€ā”€ SECURITY.md # Security best practices\nā”œā”€ā”€ CRUSH.md # Code style guide\n└── .translation_cache/ # Translation cache (auto-created)\n```\n\n## Output File Formats\n\n### Standard Translation\n\n- **Input**: `filename-es.po`\n- **Output**: `filename-es_ES.po`\n\n### WordPress Translation\n\n- **POT**: `plugin-name.pot` (translation template)\n- **PO**: `plugin-name-es_ES.po` (Spanish translations)\n- **MO**: `plugin-name-es_ES.mo` (compiled binary)\n\n## šŸ” Troubleshooting\n\n### āš ļø Common Issues\n\n
\n🚫 Rate Limiting Errors (429)\n\n**Symptoms**: API returns \"Too Many Requests\"\n\n**Solutions**:\n\n```bash\n# Increase delay between requests\n--delay 1.0\n\n# Reduce batch size\n--batch-size 10\n\n# Reduce parallel workers\n--parallel 2\n```\n\n
\n\n
\nšŸ’¾ Out of Memory\n\n**Symptoms**: Process crashes with memory errors\n\n**Solutions**:\n\n```bash\n# Reduce batch size\n--batch-size 5\n\n# Enable resume for smaller sessions\n--resume\n```\n\n
\n\n
\n🐌 Cache Not Working\n\n**Symptoms**: Translations seem slow on repeat runs\n\n**Solutions**:\n\n1. āœ… Check if `.translation_cache/` directory exists\n2. āœ… Verify `.pkl` files are being created\n3. āœ… Ensure not using `--no-cache` flag\n4. āœ… Check file permissions\n\n
\n\n
\nšŸ“ Progress File Corruption\n\n**Symptoms**: Resume fails or restarts from beginning\n\n**Solutions**:\n\n```bash\n# Delete progress file and restart\nrm output.po.progress\npython translate-po-multiple.py input.po output.po --resume\n```\n\n
\n\n
\nšŸ” API Authentication Errors\n\n**DeepL**:\n\n- āœ… Verify `DEEPL_API_KEY` in `.env`\n- āœ… Check API key validity at DeepL dashboard\n\n**Google**:\n\n- āœ… Verify `GOOGLE_CLOUD_PROJECT` and `GOOGLE_APPLICATION_CREDENTIALS`\n- āœ… Ensure service account has Translation API permissions\n- āœ… Check JSON key file path is correct\n\n**DeepSeek**:\n\n- āœ… Verify `DEEPSEEK_API_KEY` in `.env`\n- āœ… Check account has sufficient credits\n\n
\n\n### Debugging\n\nEnable debug logging:\n\n```powershell\n# Set logging level to DEBUG in script\n# Or use Python logging configuration\npython -u translate-po-multiple.py input.po output.po --api deepl\n```\n\nView cache contents:\n\n```powershell\n# Check cache directory\nls .translation_cache/\n\n# Count cached translations\n(ls .translation_cache/*.pkl).Count\n```\n\nMonitor progress file:\n\n```powershell\n# Watch progress in real-time\nGet-Content output.po.progress -Wait\n```\n\n## šŸ”„ API Comparison\n\n| Feature | ![DeepL](https://img.shields.io/badge/DeepL-0F2B46?style=flat&logo=deepl&logoColor=white) | ![Google](https://img.shields.io/badge/Google-4285F4?style=flat&logo=google&logoColor=white) | ![DeepSeek](https://img.shields.io/badge/DeepSeek-412991?style=flat&logo=openai&logoColor=white) |\n|---------|-------|--------|----------|\n| šŸŽÆ **Quality** | ⭐⭐⭐⭐⭐ Excellent | ⭐⭐⭐⭐ Very Good | ⭐⭐⭐ Good |\n| šŸ“¦ **Batch Support** | āœ… Yes (50+) | āœ… Yes (100) | āŒ No |\n| ā±ļø **Rate Limits** | 🟔 Moderate | 🟢 High | 🟔 Moderate |\n| šŸ†“ **Cost (Free)** | 500K chars/mo | $10 credit | Limited |\n| šŸ’° **Cost (Paid)** | €5.49/mo+ | Pay-per-char | Very low |\n| šŸ·ļø **HTML Preservation** | āœ… Native | āš™ļø Manual | āš™ļø Manual |\n| šŸŽÆ **Best For** | Quality | Volume | Budget |\n\n## šŸ“š Best Practices\n\n### šŸ”’ Security\n\n\n\n\n\n\n
šŸ”Never commit .env file or API keys
šŸ‘¤Use service account with minimal permissions (Google)
šŸ”„Rotate API keys periodically
šŸ“„Review SECURITY.md for detailed guidelines
\n\n### ⚔ Performance\n\n\n\n\n\n\n
šŸ“¦Start with batch translation for DeepL/Google
šŸ”€Use parallel processing for DeepSeek
šŸ’¾Enable caching for repeat translations
šŸ“Use --resume for large files
\n\n### šŸ”§ Workflow\n\n1. āœ… Always test with small sample first\n2. šŸ“ Use version control for PO files\n3. šŸ‘ļø Review automated translations\n4. šŸ’¾ Keep backup of original files\n\n### šŸ’° Cost Optimization\n\n```\nā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”\n│ šŸ’¾ Cache → 95% fewer API calls │\n│ šŸ“¦ Batch → 90% cost reduction │\n│ šŸ”® DeepSeek → Budget-friendly option │\n│ šŸ“Š Monitor → Track usage dashboards │\nā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜\n```\n\n## šŸ“– Documentation\n\n| Document | Description |\n|----------|-------------|\n| šŸ“˜ **README.md** | General usage and setup (this file) |\n| ⚔ **OPTIMIZATION_GUIDE.md** | Detailed performance optimization guide |\n| šŸ¤– **CLAUDE.md** | Project instructions and architecture |\n| šŸ”’ **SECURITY.md** | Security best practices |\n| šŸ“ **CRUSH.md** | Code style and development guidelines |\n\n## šŸ¤ Contributing\n\nContributions are welcome! Please:\n\n1. šŸ“ Fork the repository\n2. 🌿 Create a feature branch\n3. šŸ“ Follow code style in `CRUSH.md`\n4. āœ… Add tests if applicable\n5. šŸ”€ Submit a pull request\n\n[![Contributors](https://img.shields.io/badge/Contributors-Welcome-brightgreen?style=for-the-badge)](CONTRIBUTING.md)\n\n## šŸ’¬ Support\n\nFor issues, questions, or suggestions:\n\n[![Issues](https://img.shields.io/badge/GitHub-Issues-red?style=for-the-badge&logo=github)](https://github.com/yourusername/potranslate/issues)\n[![Discussions](https://img.shields.io/badge/GitHub-Discussions-blue?style=for-the-badge&logo=github)](https://github.com/yourusername/potranslate/discussions)\n[![Documentation](https://img.shields.io/badge/Read-Documentation-green?style=for-the-badge&logo=readthedocs)](https://github.com/yourusername/potranslate/wiki)\n\n## šŸ“ Changelog\n\n### Version 2.0 (Latest) ![New](https://img.shields.io/badge/NEW-brightgreen)\n\n\n\n\n\n\n\n\n\n\n\n
✨Added multi-API support (DeepL, Google, DeepSeek)
šŸ’¾Implemented translation caching (80-95% faster)
šŸ“¦Added batch translation support (5-10x faster)
šŸ”€Implemented parallel processing (2-4x faster)
šŸ’æAdded progress persistence and resume capability
šŸš€Optimized regex patterns (20-30% faster)
🧠Memory-efficient processing for large files
šŸ“–Created comprehensive optimization guide
šŸ”§Added command-line options for all features
\n\n### Version 1.0\n\n\n\n\n\n\n
šŸŽ‰Initial release with DeepL support
šŸ”„Basic PO file translation
āš™ļøPowerShell automation scripts
šŸ”ŒWordPress WP-CLI integration
\n\n## šŸ“„ License\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)\n\n```\nMIT License\n\nCopyright (c) 2024 Adalberto H. Vega\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n## šŸ™ Acknowledgments\n\n
\n\n| Technology | Purpose |\n|------------|---------|\n| ![DeepL](https://img.shields.io/badge/DeepL-0F2B46?style=flat&logo=deepl&logoColor=white) | High-quality translation API |\n| ![Google Cloud](https://img.shields.io/badge/Google_Cloud-4285F4?style=flat&logo=google-cloud&logoColor=white) | Scalable translation infrastructure |\n| ![DeepSeek](https://img.shields.io/badge/DeepSeek-412991?style=flat&logo=openai&logoColor=white) | Cost-effective AI translation |\n| ![Python](https://img.shields.io/badge/polib-Python-3776AB?style=flat&logo=python&logoColor=white) | Excellent PO file handling library |\n| ![tqdm](https://img.shields.io/badge/tqdm-Progress-orange?style=flat) | Beautiful progress bars |\n\n
\n\n---\n\n
\n\n### šŸŒ **Happy Translating!** ✨\n\n[![Made with ā¤ļø](https://img.shields.io/badge/Made%20with-%E2%9D%A4%EF%B8%8F-red?style=for-the-badge)](https://github.com/yourusername)\n[![Python](https://img.shields.io/badge/Powered%20by-Python-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://python.org)\n[![Open Source](https://img.shields.io/badge/Open-Source-success?style=for-the-badge&logo=github)](https://github.com)\n\n⭐ **Star this repo if you find it helpful!** ⭐\n\n
\n"}, "761020141e357b911fc79a70b5a8de7e0e0cf1b9": {"t": 1785772116.7478926, "n": 21992, "h": "121d47305f028f3e", "c": "# PO File Translator\n\n
\n\n![Python](https://img.shields.io/badge/Python-3.8+-3776AB?style=for-the-badge&logo=python&logoColor=white)\n![PowerShell](https://img.shields.io/badge/PowerShell-5.1+-5391FE?style=for-the-badge&logo=powershell&logoColor=white)\n![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)\n![Version](https://img.shields.io/badge/Version-2.0-blue?style=for-the-badge)\n\n[![DeepL](https://img.shields.io/badge/DeepL-API-0F2B46?style=for-the-badge&logo=deepl&logoColor=white)](https://www.deepl.com)\n[![Google Cloud](https://img.shields.io/badge/Google_Cloud-Translate-4285F4?style=for-the-badge&logo=google-cloud&logoColor=white)](https://cloud.google.com/translate)\n[![OpenAI](https://img.shields.io/badge/DeepSeek-API-412991?style=for-the-badge&logo=openai&logoColor=white)](https://www.deepseek.com)\n\n**A comprehensive tool for automating the translation of PO (Portable Object) files using multiple translation APIs with advanced performance optimizations.**\n\n[Features](#features) • [Installation](#installation) • [Usage](#usage) • [Documentation](#documentation) • [Performance](#performance-guide)\n\n
\n\n---\n\n## šŸ‘¤ Author\n\n**Adalberto H. Vega**\n\n[![GitHub](https://img.shields.io/badge/GitHub-Profile-181717?style=flat-square&logo=github)](https://github.com/yourusername)\n\n## šŸ“‹ Description\n\nThis project provides a complete suite of scripts to automate the translation of PO files commonly used in software localization, particularly for WordPress plugins and themes. It supports multiple translation APIs (DeepL, Google Cloud Translate, DeepSeek) with advanced features like batch processing, caching, parallel translation, and progress resumption.\n\n## ✨ Features\n\n### šŸŽÆ Core Features\n\n| Feature | Description | Status |\n|---------|-------------|--------|\n| 🌐 **Multi-API Support** | DeepL, Google Cloud Translate, and DeepSeek | āœ… |\n| šŸ¤– **Automated Translation** | Processes only untranslated entries in PO files | āœ… |\n| šŸ·ļø **HTML/Variable Preservation** | Maintains formatting, HTML tags, and variables (`%s`, `%d`, `{0}`) | āœ… |\n| šŸ“Š **Progress Tracking** | Real-time progress bars with tqdm | āœ… |\n| šŸ”„ **Error Handling** | Retry logic with exponential backoff | āœ… |\n| šŸ”Œ **WordPress Integration** | Scripts for POT/PO/MO file management with WP-CLI | āœ… |\n\n### ⚔ Performance Optimizations\n\n| Optimization | Benefit | Speedup |\n|--------------|---------|---------|\n| šŸ’¾ **Translation Caching** | Avoid re-translating identical strings | 80-95% faster |\n| šŸ“¦ **Batch Translation** | Process multiple strings in a single API call | 5-10x faster |\n| šŸ”€ **Parallel Processing** | Concurrent translation with configurable workers | 2-4x faster |\n| šŸ’æ **Progress Persistence** | Resume interrupted translations without losing work | Reliability |\n| šŸš€ **Compiled Regex Patterns** | Optimized HTML/variable detection | 20-30% faster |\n| 🧠 **Memory-Efficient** | Handle files with 100,000+ entries | Scalability |\n\n## šŸ“¦ Requirements\n\n### System Requirements\n\n![Python Version](https://img.shields.io/badge/Python-3.8+-blue?logo=python&logoColor=white)\n![PowerShell Version](https://img.shields.io/badge/PowerShell-5.1+-blue?logo=powershell&logoColor=white)\n![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)\n\n- Python 3.8+\n- PowerShell 5.1+ (for automation scripts)\n- Internet connection for API access\n\n### šŸ”‘ API Keys (choose one or more)\n\n\n\n\n\n\n\n
\n\"DeepL\"/
\nDeepL API Key
\nRecommended for quality\n
\n\"Google
\nGoogle Cloud Project
\nTranslation API enabled\n
\n\"DeepSeek\"/
\nDeepSeek API Key
\nCost-effective alternative\n
\n\n### šŸ“š Python Dependencies\n\n![polib](https://img.shields.io/badge/polib-1.2.0+-orange)\n![deepl](https://img.shields.io/badge/deepl-1.16.1+-blue)\n![python-dotenv](https://img.shields.io/badge/python--dotenv-1.0.0+-green)\n![tqdm](https://img.shields.io/badge/tqdm-4.66.1+-red)\n\n```python\npolib>=1.2.0 # PO file parsing\ndeepl>=1.16.1 # DeepL API client\npython-dotenv>=1.0.0 # Environment variables\ntqdm>=4.66.1 # Progress bars\nrequests # HTTP requests\nopenai # DeepSeek API client\ngoogle-cloud-translate # Google Cloud Translate v3\n```\n\n## šŸ”§ API Setup\n\n
\nšŸ”µ DeepL API Key\n\n1. **Create an Account**: Sign up at [DeepL.com](https://www.deepl.com)\n2. **Access API Keys**: Navigate to your account's 'API Keys' section\n3. **Create New Key**: Generate a new API key\n4. **Choose Plan**:\n - šŸ†“ **Free Plan**: 500,000 characters/month\n - šŸ’Ž **Pro Plan**: Unlimited translations with higher rate limits\n5. **Security**: Keep your API key confidential\n\nšŸ“– For more details: [DeepL API Documentation](https://developers.deepl.com/docs/getting-started/auth)\n\n
\n\n
\nšŸ”“ Google Cloud Translate\n\n1. **Create Project**: Go to [Google Cloud Console](https://console.cloud.google.com)\n2. **Enable API**: Enable the Cloud Translation API\n3. **Create Service Account**:\n - Go to IAM & Admin → Service Accounts\n - Create a new service account\n - Grant \"Cloud Translation API User\" role\n4. **Generate Key**: Download JSON key file\n5. **Save Key**: Store JSON file in project directory (gitignored)\n\n
\n\n
\n🟣 DeepSeek API Key\n\n1. **Sign Up**: Create account at [DeepSeek Platform](https://platform.deepseek.com)\n2. **Generate Key**: Navigate to API Keys section\n3. **Cost-Effective**: Lower pricing than DeepL/Google for high volumes\n\n
\n\n---\n\n## šŸš€ Installation\n\n### 1. Clone the Repository\n```powershell\ngit clone \ncd potranslate\n```\n\n### 2. Create Virtual Environment\n```powershell\npython -m venv .venv\n```\n\n### 3. Activate Virtual Environment\n```powershell\n# Windows PowerShell\n.\\.venv\\Scripts\\Activate.ps1\n\n# Windows CMD\n.venv\\Scripts\\activate.bat\n\n# Linux/Mac\nsource .venv/bin/activate\n```\n\n### 4. Install Dependencies\n```powershell\npip install -r requirements.txt\n```\n\n### 5. Configure Environment Variables\n\nCreate a `.env` file in the project root:\n\n```env\n# DeepL Configuration\nDEEPL_API_KEY=your-deepl-api-key-here\n\n# Google Cloud Configuration\nGOOGLE_CLOUD_PROJECT=your-project-id\nGOOGLE_APPLICATION_CREDENTIALS=path/to/service-account.json\n\n# DeepSeek Configuration\nDEEPSEEK_API_KEY=your-deepseek-api-key-here\n```\n\n**Note**: You only need to configure the API(s) you plan to use.\n\n## šŸ’» Usage\n\n### šŸŽ¬ Quick Start\n\n#### Basic Translation (Sequential)\n\n```bash\n# Using DeepL\npython translate-po-multiple.py input.po output.po --api deepl --target-lang es\n\n# Using Google Translate\npython translate-po-multiple.py input.po output.po --api google --target-lang es\n\n# Using DeepSeek\npython translate-po-multiple.py input.po output.po --api deepseek --target-lang es\n```\n\n#### ⚔ Optimized Translation (Recommended)\n\n```bash\n# DeepL with batch processing (5-10x faster)\npython translate-po-multiple.py input.po output.po --api deepl --batch-size 20\n\n# Google with larger batches (up to 100)\npython translate-po-multiple.py input.po output.po --api google --batch-size 50\n\n# DeepSeek with parallel processing (no batch support)\npython translate-po-multiple.py input.po output.po --api deepseek --parallel 4\n```\n\n#### šŸ“ Large File Translation (with resume capability)\n\n```bash\n# Start translation with progress tracking\npython translate-po-multiple.py large.po output.po --api deepl --batch-size 30 --resume\n\n# If interrupted, resume from where it left off\npython translate-po-multiple.py large.po output.po --api deepl --batch-size 30 --resume\n```\n\n### PowerShell Automation Scripts\n\n#### Direct Translation\n```powershell\n# Translate a PO file using the virtual environment wrapper\n.\\trans-po.ps1 -filename \"path\\to\\file.po\"\n```\n\n#### Download Folder Workflow\n```powershell\n# Process file from Downloads (for WordPress plugin translations)\n.\\process-po.ps1 -FilePrefix \"elementor-1142\"\n\n# Expects: elementor-1142-es.po in Downloads\n# Outputs: elementor-1142-es_ES.po back to Downloads\n```\n\n### WordPress Translation Workflow\n\n#### 1. Generate POT and PO Files\n```powershell\n# Create PO file for Spanish\n.\\make-po.ps1 es\n\n# Creates: languages/your-plugin-es_ES.po\n```\n\n#### 2. Translate the PO File\n```powershell\n# Translate using optimized batch processing\n.\\trans-po.ps1 -filename \"languages\\your-plugin-es_ES.po\"\n```\n\n#### 3. Compile to MO File\n```powershell\n# Compile for WordPress\n.\\make-mo.ps1 es\n\n# Creates: languages/your-plugin-es_ES.mo\n```\n\n### Advanced Options\n\n#### Command-Line Parameters\n\n```powershell\npython translate-po-multiple.py input.po output.po [OPTIONS]\n\nOptions:\n --api {deepl,deepseek,google} Translation API (default: deepl)\n --target-lang LANG Target language code (default: es)\n --batch-size SIZE Strings per batch (default: 10)\n --parallel WORKERS Parallel workers (default: 1)\n --no-cache Disable translation caching\n --resume Resume from previous progress\n --delay SECONDS Delay between translations (default: 0.5)\n```\n\n#### Example Configurations\n\n**Small Files (< 500 entries)**\n```powershell\npython translate-po-multiple.py input.po output.po --api deepl\n```\n\n**Medium Files (500-5000 entries)**\n```powershell\n# DeepL\npython translate-po-multiple.py input.po output.po --api deepl --batch-size 20\n\n# Google\npython translate-po-multiple.py input.po output.po --api google --batch-size 50\n```\n\n**Large Files (5000+ entries)**\n```powershell\n# DeepL with resume capability\npython translate-po-multiple.py input.po output.po \\\n --api deepl \\\n --batch-size 30 \\\n --resume\n\n# Google with maximum batch size\npython translate-po-multiple.py input.po output.po \\\n --api google \\\n --batch-size 100 \\\n --resume\n```\n\n**DeepSeek (no batch support)**\n```powershell\npython translate-po-multiple.py input.po output.po \\\n --api deepseek \\\n --parallel 3 \\\n --delay 0.3\n```\n\n**Development/Testing**\n```powershell\n# Force fresh translations without cache\npython translate-po-multiple.py test.po output.po \\\n --api deepl \\\n --no-cache \\\n --batch-size 5\n```\n\n## šŸ“Š Performance Guide\n\n### šŸš€ Expected Performance Improvements\n\n| File Size | Method | Time (Before) | Time (After) | Improvement |\n|-----------|--------|---------------|--------------|-------------|\n| 500 entries | Sequential | ā±ļø ~4 min | ⚔ ~45 sec | ![5.3x](https://img.shields.io/badge/5.3x-faster-brightgreen) |\n| 1000 entries | Batch (20) | ā±ļø ~8 min | ⚔ ~90 sec | ![5.3x](https://img.shields.io/badge/5.3x-faster-brightgreen) |\n| 5000 entries | Batch (50) | ā±ļø ~42 min | ⚔ ~5 min | ![8.4x](https://img.shields.io/badge/8.4x-faster-green) |\n| 10000 entries | Batch + Cache | ā±ļø ~84 min | ⚔ ~6 min | ![14x](https://img.shields.io/badge/14x-faster-success) |\n\n### šŸ’” Optimization Recommendations\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
āœ…Always use caching unless testing (enabled by default)
šŸ“¦Use batch translation for DeepL and Google (10-50x faster)
šŸ”€Use parallel processing for DeepSeek (2-4x faster)
šŸ’¾Enable resume for files > 1000 entries
ā²ļøAdjust delay if hitting rate limits
\n\n### šŸ’¾ Caching Benefits\n\n```mermaid\ngraph LR\n A[First run] -->|Normal speed| B[Cache built]\n B -->|50% new| C[~2x faster]\n B -->|100% cached| D[~50x faster ⚔]\n style D fill:#90EE90\n```\n\n- šŸ”„ **First run**: Normal speed, builds cache\n- ⚔ **Second run (50% new content)**: ~2x faster\n- šŸš€ **Re-translation (100% cached)**: ~50x faster (instant)\n\n## File Structure\n\n```\npotranslate/\nā”œā”€ā”€ translate-po.py # Original DeepL-only translator\nā”œā”€ā”€ translate-po-multiple.py # Multi-API translator with optimizations\nā”œā”€ā”€ trans-po.ps1 # Virtual environment wrapper\nā”œā”€ā”€ process-po.ps1 # Downloads folder workflow\nā”œā”€ā”€ make-po.ps1 # Generate POT/PO files (WP-CLI)\nā”œā”€ā”€ make-mo.ps1 # Compile MO files (WP-CLI)\nā”œā”€ā”€ requirements.txt # Python dependencies\nā”œā”€ā”€ .env # API keys (not committed)\nā”œā”€ā”€ .gitignore # Git ignore rules\nā”œā”€ā”€ README.md # This file\nā”œā”€ā”€ CLAUDE.md # Project instructions for Claude Code\nā”œā”€ā”€ OPTIMIZATION_GUIDE.md # Detailed optimization guide\nā”œā”€ā”€ SECURITY.md # Security best practices\nā”œā”€ā”€ CRUSH.md # Code style guide\n└── .translation_cache/ # Translation cache (auto-created)\n```\n\n## Output File Formats\n\n### Standard Translation\n- **Input**: `filename-es.po`\n- **Output**: `filename-es_ES.po`\n\n### WordPress Translation\n- **POT**: `plugin-name.pot` (translation template)\n- **PO**: `plugin-name-es_ES.po` (Spanish translations)\n- **MO**: `plugin-name-es_ES.mo` (compiled binary)\n\n## šŸ” Troubleshooting\n\n### āš ļø Common Issues\n\n
\n🚫 Rate Limiting Errors (429)\n\n**Symptoms**: API returns \"Too Many Requests\"\n\n**Solutions**:\n```bash\n# Increase delay between requests\n--delay 1.0\n\n# Reduce batch size\n--batch-size 10\n\n# Reduce parallel workers\n--parallel 2\n```\n\n
\n\n
\nšŸ’¾ Out of Memory\n\n**Symptoms**: Process crashes with memory errors\n\n**Solutions**:\n```bash\n# Reduce batch size\n--batch-size 5\n\n# Enable resume for smaller sessions\n--resume\n```\n\n
\n\n
\n🐌 Cache Not Working\n\n**Symptoms**: Translations seem slow on repeat runs\n\n**Solutions**:\n1. āœ… Check if `.translation_cache/` directory exists\n2. āœ… Verify `.pkl` files are being created\n3. āœ… Ensure not using `--no-cache` flag\n4. āœ… Check file permissions\n\n
\n\n
\nšŸ“ Progress File Corruption\n\n**Symptoms**: Resume fails or restarts from beginning\n\n**Solutions**:\n```bash\n# Delete progress file and restart\nrm output.po.progress\npython translate-po-multiple.py input.po output.po --resume\n```\n\n
\n\n
\nšŸ” API Authentication Errors\n\n**DeepL**:\n- āœ… Verify `DEEPL_API_KEY` in `.env`\n- āœ… Check API key validity at DeepL dashboard\n\n**Google**:\n- āœ… Verify `GOOGLE_CLOUD_PROJECT` and `GOOGLE_APPLICATION_CREDENTIALS`\n- āœ… Ensure service account has Translation API permissions\n- āœ… Check JSON key file path is correct\n\n**DeepSeek**:\n- āœ… Verify `DEEPSEEK_API_KEY` in `.env`\n- āœ… Check account has sufficient credits\n\n
\n\n### Debugging\n\nEnable debug logging:\n```powershell\n# Set logging level to DEBUG in script\n# Or use Python logging configuration\npython -u translate-po-multiple.py input.po output.po --api deepl\n```\n\nView cache contents:\n```powershell\n# Check cache directory\nls .translation_cache/\n\n# Count cached translations\n(ls .translation_cache/*.pkl).Count\n```\n\nMonitor progress file:\n```powershell\n# Watch progress in real-time\nGet-Content output.po.progress -Wait\n```\n\n## šŸ”„ API Comparison\n\n| Feature | ![DeepL](https://img.shields.io/badge/DeepL-0F2B46?style=flat&logo=deepl&logoColor=white) | ![Google](https://img.shields.io/badge/Google-4285F4?style=flat&logo=google&logoColor=white) | ![DeepSeek](https://img.shields.io/badge/DeepSeek-412991?style=flat&logo=openai&logoColor=white) |\n|---------|-------|--------|----------|\n| šŸŽÆ **Quality** | ⭐⭐⭐⭐⭐ Excellent | ⭐⭐⭐⭐ Very Good | ⭐⭐⭐ Good |\n| šŸ“¦ **Batch Support** | āœ… Yes (50+) | āœ… Yes (100) | āŒ No |\n| ā±ļø **Rate Limits** | 🟔 Moderate | 🟢 High | 🟔 Moderate |\n| šŸ†“ **Cost (Free)** | 500K chars/mo | $10 credit | Limited |\n| šŸ’° **Cost (Paid)** | €5.49/mo+ | Pay-per-char | Very low |\n| šŸ·ļø **HTML Preservation** | āœ… Native | āš™ļø Manual | āš™ļø Manual |\n| šŸŽÆ **Best For** | Quality | Volume | Budget |\n\n## šŸ“š Best Practices\n\n### šŸ”’ Security\n\n\n\n\n\n\n
šŸ”Never commit .env file or API keys
šŸ‘¤Use service account with minimal permissions (Google)
šŸ”„Rotate API keys periodically
šŸ“„Review SECURITY.md for detailed guidelines
\n\n### ⚔ Performance\n\n\n\n\n\n\n
šŸ“¦Start with batch translation for DeepL/Google
šŸ”€Use parallel processing for DeepSeek
šŸ’¾Enable caching for repeat translations
šŸ“Use --resume for large files
\n\n### šŸ”§ Workflow\n\n1. āœ… Always test with small sample first\n2. šŸ“ Use version control for PO files\n3. šŸ‘ļø Review automated translations\n4. šŸ’¾ Keep backup of original files\n\n### šŸ’° Cost Optimization\n\n```\nā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”\n│ šŸ’¾ Cache → 95% fewer API calls │\n│ šŸ“¦ Batch → 90% cost reduction │\n│ šŸ”® DeepSeek → Budget-friendly option │\n│ šŸ“Š Monitor → Track usage dashboards │\nā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜\n```\n\n## šŸ“– Documentation\n\n| Document | Description |\n|----------|-------------|\n| šŸ“˜ **README.md** | General usage and setup (this file) |\n| ⚔ **OPTIMIZATION_GUIDE.md** | Detailed performance optimization guide |\n| šŸ¤– **CLAUDE.md** | Project instructions and architecture |\n| šŸ”’ **SECURITY.md** | Security best practices |\n| šŸ“ **CRUSH.md** | Code style and development guidelines |\n\n## šŸ¤ Contributing\n\nContributions are welcome! Please:\n\n1. šŸ“ Fork the repository\n2. 🌿 Create a feature branch\n3. šŸ“ Follow code style in `CRUSH.md`\n4. āœ… Add tests if applicable\n5. šŸ”€ Submit a pull request\n\n[![Contributors](https://img.shields.io/badge/Contributors-Welcome-brightgreen?style=for-the-badge)](CONTRIBUTING.md)\n\n## šŸ’¬ Support\n\nFor issues, questions, or suggestions:\n\n[![Issues](https://img.shields.io/badge/GitHub-Issues-red?style=for-the-badge&logo=github)](https://github.com/yourusername/potranslate/issues)\n[![Discussions](https://img.shields.io/badge/GitHub-Discussions-blue?style=for-the-badge&logo=github)](https://github.com/yourusername/potranslate/discussions)\n[![Documentation](https://img.shields.io/badge/Read-Documentation-green?style=for-the-badge&logo=readthedocs)](https://github.com/yourusername/potranslate/wiki)\n\n## šŸ“ Changelog\n\n### Version 2.0 (Latest) ![New](https://img.shields.io/badge/NEW-brightgreen)\n\n\n\n\n\n\n\n\n\n\n\n
✨Added multi-API support (DeepL, Google, DeepSeek)
šŸ’¾Implemented translation caching (80-95% faster)
šŸ“¦Added batch translation support (5-10x faster)
šŸ”€Implemented parallel processing (2-4x faster)
šŸ’æAdded progress persistence and resume capability
šŸš€Optimized regex patterns (20-30% faster)
🧠Memory-efficient processing for large files
šŸ“–Created comprehensive optimization guide
šŸ”§Added command-line options for all features
\n\n### Version 1.0\n\n\n\n\n\n\n
šŸŽ‰Initial release with DeepL support
šŸ”„Basic PO file translation
āš™ļøPowerShell automation scripts
šŸ”ŒWordPress WP-CLI integration
\n\n## šŸ“„ License\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)\n\n```\nMIT License\n\nCopyright (c) 2024 Adalberto H. Vega\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n## šŸ™ Acknowledgments\n\n
\n\n| Technology | Purpose |\n|------------|---------|\n| ![DeepL](https://img.shields.io/badge/DeepL-0F2B46?style=flat&logo=deepl&logoColor=white) | High-quality translation API |\n| ![Google Cloud](https://img.shields.io/badge/Google_Cloud-4285F4?style=flat&logo=google-cloud&logoColor=white) | Scalable translation infrastructure |\n| ![DeepSeek](https://img.shields.io/badge/DeepSeek-412991?style=flat&logo=openai&logoColor=white) | Cost-effective AI translation |\n| ![Python](https://img.shields.io/badge/polib-Python-3776AB?style=flat&logo=python&logoColor=white) | Excellent PO file handling library |\n| ![tqdm](https://img.shields.io/badge/tqdm-Progress-orange?style=flat) | Beautiful progress bars |\n\n
\n\n---\n\n
\n\n### šŸŒ **Happy Translating!** ✨\n\n[![Made with ā¤ļø](https://img.shields.io/badge/Made%20with-%E2%9D%A4%EF%B8%8F-red?style=for-the-badge)](https://github.com/yourusername)\n[![Python](https://img.shields.io/badge/Powered%20by-Python-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://python.org)\n[![Open Source](https://img.shields.io/badge/Open-Source-success?style=for-the-badge&logo=github)](https://github.com)\n\n⭐ **Star this repo if you find it helpful!** ⭐\n\n
\n"}, "fd616fbefeb76c0dc128a96d10723fd1822e67cc": {"t": 1785772118.4566224, "n": 3005, "h": "e04092dc76f384a7", "c": "# PO File Translator\n\nA tool for automating the translation of PO (Portable Object) files using DeepL API.\n\n## Author\n\nAdalberto H. Vega\n\n## Description\n\nThis project provides a set of scripts to automate the translation of PO files commonly used in software localization. It uses the DeepL API for high-quality translations and maintains the formatting of the original text, including HTML tags.\n\n## Features\n\n- Automated translation of untranslated entries in PO files\n- Preserves HTML formatting and tags\n- Progress bar showing translation status\n- Error handling for failed translations\n- Support for different target languages (default: Spanish)\n- Virtual environment management\n\n## Requirements\n\n- Python 3.x\n- PowerShell\n- DeepL API key\n- Virtual environment (.venv)\n\n### Python Dependencies\n\n- polib: For handling PO files\n- deepl: DeepL API client\n- python-dotenv: For environment variable management\n- tqdm: For progress bar functionality\n\n## Obtaining a DeepL API Key\n\nTo use this translation tool, you'll need a DeepL API key. Follow these steps to get started:\n\n1. **Create an Account**: Sign up at [DeepL.com](https://www.deepl.com)\n2. **Access API Keys**: Go to your account and navigate to the 'API Keys' section\n3. **Create New Key**: Click 'Create key' to generate a new API key\n4. **Choose Plan**: Select either:\n - **Free Plan**: 500,000 characters/month\n - **Pro Plan**: Unlimited translations with advanced features\n5. **Security Note**: Keep your API key confidential and never expose it in publicly distributed code\n\nFor more details, visit the [DeepL API Documentation](https://developers.deepl.com/docs/getting-started/auth)\n\n## Setup\n\n1. Clone the repository\n2. Create a virtual environment:\n\n ```powershell\n python -m venv .venv\n ```\n\n3. Activate the virtual environment:\n\n ```powershell\n .\\.venv\\Scripts\\Activate.ps1\n ```\n\n4. Install dependencies:\n\n ```powershell\n pip install -r requirements.txt\n ```\n\n5. Create a `.env` file in the project root with your DeepL API key:\n\n ```env\n DEEPL_API_KEY=your-api-key-here\n ```\n\n## Usage\n\n### Basic Translation\n\nTo translate a PO file:\n\n```powershell\n.\\trans-po.ps1 -filename \"path\\to\\your\\file.po\"\n```\n\n### Processing Files from Downloads\n\nTo process a PO file from your Downloads folder:\n\n```powershell\n.\\process-po.ps1 -FilePrefix \"your-file-prefix\"\n```\n\nFor example, if your file is named \"elementor-1142-es.po\", use:\n\n```powershell\n.\\process-po.ps1 -FilePrefix \"elementor-1142\"\n```\n\nThe script will:\n\n1. Look for the file in your Downloads folder\n2. Process the translation\n3. Save the result as \"elementor-1142-es_ES.po\" back in your Downloads folder\n\n### Output Files\n\n- Input file format: `filename-es.po`\n- Output file format: `filename-es_ES.po`\n\n### Common Issues\n\n- Make sure your `.env` file contains a valid DeepL API key\n- Virtual environment must be set up before running the scripts\n- Input files must be valid PO format files\n\n## License\n\nMIT License\n\nCopyright (c) 2024 Adalberto H. Vega\n"}, "d2ac43e3feaf6fe6fb23764fb92f530fd526be91": {"t": 1785772119.5952759, "n": 2299, "h": "0559afe022dbb813", "c": "# PO File Translator\n\nA tool for automating the translation of PO (Portable Object) files using DeepL API.\n\n## Author\n\nAdalberto H. Vega\n\n## Description\n\nThis project provides a set of scripts to automate the translation of PO files commonly used in software localization. It uses the DeepL API for high-quality translations and maintains the formatting of the original text, including HTML tags.\n\n## Features\n\n- Automated translation of untranslated entries in PO files\n- Preserves HTML formatting and tags\n- Progress bar showing translation status\n- Error handling for failed translations\n- Support for different target languages (default: Spanish)\n- Virtual environment management\n\n## Requirements\n\n- Python 3.x\n- PowerShell\n- DeepL API key\n- Virtual environment (.venv)\n\n### Python Dependencies\n\n- polib: For handling PO files\n- deepl: DeepL API client\n- python-dotenv: For environment variable management\n- tqdm: For progress bar functionality\n\n## Setup\n\n1. Clone the repository\n2. Create a virtual environment:\n\n ```powershell\n python -m venv .venv\n ```\n\n3. Activate the virtual environment:\n\n ```powershell\n .\\.venv\\Scripts\\Activate.ps1\n ```\n\n4. Install dependencies:\n\n ```powershell\n pip install -r requirements.txt\n ```\n\n5. Create a `.env` file in the project root with your DeepL API key:\n\n ```env\n DEEPL_API_KEY=your-api-key-here\n ```\n\n## Usage\n\n### Basic Translation\n\nTo translate a PO file:\n\n```powershell\n.\\trans-po.ps1 -filename \"path\\to\\your\\file.po\"\n```\n\n### Processing Files from Downloads\n\nTo process a PO file from your Downloads folder:\n\n```powershell\n.\\process-po.ps1 -FilePrefix \"your-file-prefix\"\n```\n\nFor example, if your file is named \"elementor-1142-es.po\", use:\n\n```powershell\n.\\process-po.ps1 -FilePrefix \"elementor-1142\"\n```\n\nThe script will:\n\n1. Look for the file in your Downloads folder\n2. Process the translation\n3. Save the result as \"elementor-1142-es_ES.po\" back in your Downloads folder\n\n### Output Files\n\n- Input file format: `filename-es.po`\n- Output file format: `filename-es_ES.po`\n\n### Common Issues\n\n- Make sure your `.env` file contains a valid DeepL API key\n- Virtual environment must be set up before running the scripts\n- Input files must be valid PO format files\n\n## License\n\nMIT License\n\nCopyright (c) 2024 Adalberto H. Vega\n"}}}}