# ๐Ÿ“‹ QUICK REFERENCE CARD ## ๐Ÿš€ Start Server ```powershell .\start.ps1 ``` Or manually: ```powershell .\venv\Scripts\Activate.ps1 python main.py ``` ## ๐ŸŒ API URLs | Endpoint | URL | |----------|-----| | Swagger Docs | http://localhost:8000/docs | | ReDoc | http://localhost:8000/redoc | | Health Check | http://localhost:8000/health | | Languages | http://localhost:8000/languages | ## ๐Ÿ“ค Translate Document ### PowerShell ```powershell $file = Get-Item "document.xlsx" Invoke-RestMethod -Uri "http://localhost:8000/translate" ` -Method Post ` -Form @{file=$file; target_language="es"} ` -OutFile "translated.xlsx" ``` ### Python ```python import requests with open('doc.xlsx', 'rb') as f: r = requests.post('http://localhost:8000/translate', files={'file': f}, data={'target_language': 'es'}) with open('translated.xlsx', 'wb') as out: out.write(r.content) ``` ### cURL ```bash curl -X POST "http://localhost:8000/translate" \ -F "file=@document.xlsx" \ -F "target_language=es" \ --output translated.xlsx ``` ## ๐ŸŒ Language Codes | Code | Language | Code | Language | |------|----------|------|----------| | `es` | Spanish | `fr` | French | | `de` | German | `it` | Italian | | `pt` | Portuguese | `ru` | Russian | | `zh` | Chinese | `ja` | Japanese | | `ko` | Korean | `ar` | Arabic | | `hi` | Hindi | `nl` | Dutch | [Full list: http://localhost:8000/languages] ## ๐Ÿ“„ Supported Formats - `.xlsx` - Excel (formulas, formatting, images) - `.docx` - Word (styles, tables, images) - `.pptx` - PowerPoint (layouts, animations, media) ## โš™๏ธ Configuration (.env) ```env TRANSLATION_SERVICE=google # or: deepl, libre DEEPL_API_KEY=your_key # if using DeepL MAX_FILE_SIZE_MB=50 # max upload size ``` ## ๐Ÿ“ Project Structure ``` Translate/ โ”œโ”€โ”€ main.py # API application โ”œโ”€โ”€ config.py # Configuration โ”œโ”€โ”€ start.ps1 # Startup script โ”‚ โ”œโ”€โ”€ services/ # Translation services โ”‚ โ””โ”€โ”€ translation_service.py โ”‚ โ”œโ”€โ”€ translators/ # Format handlers โ”‚ โ”œโ”€โ”€ excel_translator.py โ”‚ โ”œโ”€โ”€ word_translator.py โ”‚ โ””โ”€โ”€ pptx_translator.py โ”‚ โ”œโ”€โ”€ utils/ # Utilities โ”‚ โ”œโ”€โ”€ file_handler.py โ”‚ โ””โ”€โ”€ exceptions.py โ”‚ โ””โ”€โ”€ [docs]/ # Documentation โ”œโ”€โ”€ README.md โ”œโ”€โ”€ QUICKSTART.md โ”œโ”€โ”€ ARCHITECTURE.md โ””โ”€โ”€ DEPLOYMENT.md ``` ## ๐Ÿงช Testing ```powershell # Test API python test_api.py # Run examples python examples.py ``` ## ๐Ÿ”ง Troubleshooting ### Port in use ```python # Edit main.py line 307: uvicorn.run(app, host="0.0.0.0", port=8001) ``` ### Module not found ```powershell .\venv\Scripts\Activate.ps1 pip install -r requirements.txt ``` ### Execution policy (Windows) ```powershell Set-ExecutionPolicy RemoteSigned -Scope CurrentUser ``` ## ๐Ÿ“Š API Response Headers ``` X-Original-Filename: document.xlsx X-File-Size-MB: 2.5 X-Target-Language: es ``` ## ๐ŸŽฏ Common Tasks ### Check API Status ```powershell curl http://localhost:8000/health ``` ### List Languages ```powershell curl http://localhost:8000/languages ``` ### Download File ```powershell curl http://localhost:8000/download/filename.xlsx -o local.xlsx ``` ### Cleanup File ```powershell curl -X DELETE http://localhost:8000/cleanup/filename.xlsx ``` ## ๐Ÿ’ก Tips - Use `auto` for source language auto-detection - Set `cleanup=true` to delete uploads automatically - Max file size: 50MB (configurable) - Processing time: ~1-5 seconds per document ## ๐Ÿ“š Documentation Files | File | Purpose | |------|---------| | `QUICKSTART.md` | 5-minute setup guide | | `README.md` | Complete documentation | | `ARCHITECTURE.md` | Technical design | | `DEPLOYMENT.md` | Production setup | | `CHECKLIST.md` | Feature checklist | | `PROJECT_SUMMARY.md` | Project overview | ## ๐Ÿ”Œ MCP Integration ```powershell # Install MCP dependencies pip install -r requirements-mcp.txt # Run MCP server python mcp_server_example.py ``` ## ๐Ÿ“ž Quick Commands | Command | Purpose | |---------|---------| | `.\start.ps1` | Start API server | | `python test_api.py` | Test API | | `python examples.py` | Run examples | | `pip install -r requirements.txt` | Install deps | ## ๐ŸŽจ Format Preservation ### Excel โœ… Formulas, merged cells, fonts, colors, borders, images ### Word โœ… Styles, headings, lists, tables, headers/footers, images ### PowerPoint โœ… Layouts, animations, transitions, media, positioning --- ## ๐Ÿš€ QUICK START ```powershell cd d:\Translate .\start.ps1 # Visit: http://localhost:8000/docs ``` --- **Print this card for quick reference! ๐Ÿ“‹**