Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/ahvega_potranslate.json
T

1 line
52 KiB
JSON

{"repo": "ahvega/potranslate", "files": {"README.md": {"544618966f8d9a6a5149cebf1ba5891c29b1790a": {"t": 1785747280.8115678, "n": 22018, "h": "5fd1f83d18c4d4a6", "c": "# PO File Translator\n\n<div align=\"center\">\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</div>\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<table>\n<tr>\n<td align=\"center\">\n<img src=\"https://img.shields.io/badge/DeepL-0F2B46?style=flat&logo=deepl&logoColor=white\" alt=\"DeepL\"/><br/>\n<b>DeepL API Key</b><br/>\n<i>Recommended for quality</i>\n</td>\n<td align=\"center\">\n<img src=\"https://img.shields.io/badge/Google_Cloud-4285F4?style=flat&logo=google-cloud&logoColor=white\" alt=\"Google Cloud\"/><br/>\n<b>Google Cloud Project</b><br/>\n<i>Translation API enabled</i>\n</td>\n<td align=\"center\">\n<img src=\"https://img.shields.io/badge/DeepSeek-412991?style=flat&logo=openai&logoColor=white\" alt=\"DeepSeek\"/><br/>\n<b>DeepSeek API Key</b><br/>\n<i>Cost-effective alternative</i>\n</td>\n</tr>\n</table>\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<details>\n<summary><b>🔵 DeepL API Key</b></summary>\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</details>\n\n<details>\n<summary><b>🔴 Google Cloud Translate</b></summary>\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</details>\n\n<details>\n<summary><b>🟣 DeepSeek API Key</b></summary>\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</details>\n\n---\n\n## 🚀 Installation\n\n### 1. Clone the Repository\n\n```powershell\ngit clone <repository-url>\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<table>\n<tr>\n<td>✅</td>\n<td><b>Always use caching</b> unless testing (enabled by default)</td>\n</tr>\n<tr>\n<td>📦</td>\n<td><b>Use batch translation</b> for DeepL and Google (10-50x faster)</td>\n</tr>\n<tr>\n<td>🔀</td>\n<td><b>Use parallel processing</b> for DeepSeek (2-4x faster)</td>\n</tr>\n<tr>\n<td>💾</td>\n<td><b>Enable resume</b> for files > 1000 entries</td>\n</tr>\n<tr>\n<td>⏲️</td>\n<td><b>Adjust delay</b> if hitting rate limits</td>\n</tr>\n</table>\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<details>\n<summary><b>🚫 Rate Limiting Errors (429)</b></summary>\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</details>\n\n<details>\n<summary><b>💾 Out of Memory</b></summary>\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</details>\n\n<details>\n<summary><b>🐌 Cache Not Working</b></summary>\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</details>\n\n<details>\n<summary><b>📝 Progress File Corruption</b></summary>\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</details>\n\n<details>\n<summary><b>🔐 API Authentication Errors</b></summary>\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</details>\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<table>\n<tr><td>🔐</td><td>Never commit <code>.env</code> file or API keys</td></tr>\n<tr><td>👤</td><td>Use service account with minimal permissions (Google)</td></tr>\n<tr><td>🔄</td><td>Rotate API keys periodically</td></tr>\n<tr><td>📄</td><td>Review <code>SECURITY.md</code> for detailed guidelines</td></tr>\n</table>\n\n### ⚡ Performance\n\n<table>\n<tr><td>📦</td><td>Start with batch translation for DeepL/Google</td></tr>\n<tr><td>🔀</td><td>Use parallel processing for DeepSeek</td></tr>\n<tr><td>💾</td><td>Enable caching for repeat translations</td></tr>\n<tr><td>📁</td><td>Use <code>--resume</code> for large files</td></tr>\n</table>\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<table>\n<tr><td>✨</td><td>Added multi-API support (DeepL, Google, DeepSeek)</td></tr>\n<tr><td>💾</td><td>Implemented translation caching (80-95% faster)</td></tr>\n<tr><td>📦</td><td>Added batch translation support (5-10x faster)</td></tr>\n<tr><td>🔀</td><td>Implemented parallel processing (2-4x faster)</td></tr>\n<tr><td>💿</td><td>Added progress persistence and resume capability</td></tr>\n<tr><td>🚀</td><td>Optimized regex patterns (20-30% faster)</td></tr>\n<tr><td>🧠</td><td>Memory-efficient processing for large files</td></tr>\n<tr><td>📖</td><td>Created comprehensive optimization guide</td></tr>\n<tr><td>🔧</td><td>Added command-line options for all features</td></tr>\n</table>\n\n### Version 1.0\n\n<table>\n<tr><td>🎉</td><td>Initial release with DeepL support</td></tr>\n<tr><td>🔄</td><td>Basic PO file translation</td></tr>\n<tr><td>⚙️</td><td>PowerShell automation scripts</td></tr>\n<tr><td>🔌</td><td>WordPress WP-CLI integration</td></tr>\n</table>\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<div align=\"center\">\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</div>\n\n---\n\n<div align=\"center\">\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</div>\n"}, "761020141e357b911fc79a70b5a8de7e0e0cf1b9": {"t": 1785772116.7478926, "n": 21992, "h": "121d47305f028f3e", "c": "# PO File Translator\n\n<div align=\"center\">\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</div>\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<table>\n<tr>\n<td align=\"center\">\n<img src=\"https://img.shields.io/badge/DeepL-0F2B46?style=flat&logo=deepl&logoColor=white\" alt=\"DeepL\"/><br/>\n<b>DeepL API Key</b><br/>\n<i>Recommended for quality</i>\n</td>\n<td align=\"center\">\n<img src=\"https://img.shields.io/badge/Google_Cloud-4285F4?style=flat&logo=google-cloud&logoColor=white\" alt=\"Google Cloud\"/><br/>\n<b>Google Cloud Project</b><br/>\n<i>Translation API enabled</i>\n</td>\n<td align=\"center\">\n<img src=\"https://img.shields.io/badge/DeepSeek-412991?style=flat&logo=openai&logoColor=white\" alt=\"DeepSeek\"/><br/>\n<b>DeepSeek API Key</b><br/>\n<i>Cost-effective alternative</i>\n</td>\n</tr>\n</table>\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<details>\n<summary><b>🔵 DeepL API Key</b></summary>\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</details>\n\n<details>\n<summary><b>🔴 Google Cloud Translate</b></summary>\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</details>\n\n<details>\n<summary><b>🟣 DeepSeek API Key</b></summary>\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</details>\n\n---\n\n## 🚀 Installation\n\n### 1. Clone the Repository\n```powershell\ngit clone <repository-url>\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<table>\n<tr>\n<td>✅</td>\n<td><b>Always use caching</b> unless testing (enabled by default)</td>\n</tr>\n<tr>\n<td>📦</td>\n<td><b>Use batch translation</b> for DeepL and Google (10-50x faster)</td>\n</tr>\n<tr>\n<td>🔀</td>\n<td><b>Use parallel processing</b> for DeepSeek (2-4x faster)</td>\n</tr>\n<tr>\n<td>💾</td>\n<td><b>Enable resume</b> for files > 1000 entries</td>\n</tr>\n<tr>\n<td>⏲️</td>\n<td><b>Adjust delay</b> if hitting rate limits</td>\n</tr>\n</table>\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<details>\n<summary><b>🚫 Rate Limiting Errors (429)</b></summary>\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</details>\n\n<details>\n<summary><b>💾 Out of Memory</b></summary>\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</details>\n\n<details>\n<summary><b>🐌 Cache Not Working</b></summary>\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</details>\n\n<details>\n<summary><b>📝 Progress File Corruption</b></summary>\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</details>\n\n<details>\n<summary><b>🔐 API Authentication Errors</b></summary>\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</details>\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<table>\n<tr><td>🔐</td><td>Never commit <code>.env</code> file or API keys</td></tr>\n<tr><td>👤</td><td>Use service account with minimal permissions (Google)</td></tr>\n<tr><td>🔄</td><td>Rotate API keys periodically</td></tr>\n<tr><td>📄</td><td>Review <code>SECURITY.md</code> for detailed guidelines</td></tr>\n</table>\n\n### ⚡ Performance\n\n<table>\n<tr><td>📦</td><td>Start with batch translation for DeepL/Google</td></tr>\n<tr><td>🔀</td><td>Use parallel processing for DeepSeek</td></tr>\n<tr><td>💾</td><td>Enable caching for repeat translations</td></tr>\n<tr><td>📁</td><td>Use <code>--resume</code> for large files</td></tr>\n</table>\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<table>\n<tr><td>✨</td><td>Added multi-API support (DeepL, Google, DeepSeek)</td></tr>\n<tr><td>💾</td><td>Implemented translation caching (80-95% faster)</td></tr>\n<tr><td>📦</td><td>Added batch translation support (5-10x faster)</td></tr>\n<tr><td>🔀</td><td>Implemented parallel processing (2-4x faster)</td></tr>\n<tr><td>💿</td><td>Added progress persistence and resume capability</td></tr>\n<tr><td>🚀</td><td>Optimized regex patterns (20-30% faster)</td></tr>\n<tr><td>🧠</td><td>Memory-efficient processing for large files</td></tr>\n<tr><td>📖</td><td>Created comprehensive optimization guide</td></tr>\n<tr><td>🔧</td><td>Added command-line options for all features</td></tr>\n</table>\n\n### Version 1.0\n\n<table>\n<tr><td>🎉</td><td>Initial release with DeepL support</td></tr>\n<tr><td>🔄</td><td>Basic PO file translation</td></tr>\n<tr><td>⚙️</td><td>PowerShell automation scripts</td></tr>\n<tr><td>🔌</td><td>WordPress WP-CLI integration</td></tr>\n</table>\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<div align=\"center\">\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</div>\n\n---\n\n<div align=\"center\">\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</div>\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"}}}}