{"id":23688820,"url":"https://github.com/hamadrehman/flask-translation","last_synced_at":"2026-04-28T12:03:12.516Z","repository":{"id":269748470,"uuid":"908345208","full_name":"hamadrehman/flask-translation","owner":"hamadrehman","description":"a simple webserver to serve custom translated webpages webpages. ","archived":false,"fork":false,"pushed_at":"2024-12-25T20:18:31.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-22T04:11:29.588Z","etag":null,"topics":["asyncio","flask","lxml","python","python3","waitress"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hamadrehman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-25T20:08:02.000Z","updated_at":"2024-12-25T20:29:45.000Z","dependencies_parsed_at":"2024-12-25T21:19:04.888Z","dependency_job_id":"a931f6ba-3d1e-4e78-9460-2e4158a17176","html_url":"https://github.com/hamadrehman/flask-translation","commit_stats":null,"previous_names":["hamadrehman/flask-translation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hamadrehman/flask-translation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamadrehman%2Fflask-translation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamadrehman%2Fflask-translation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamadrehman%2Fflask-translation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamadrehman%2Fflask-translation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hamadrehman","download_url":"https://codeload.github.com/hamadrehman/flask-translation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamadrehman%2Fflask-translation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32379629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","flask","lxml","python","python3","waitress"],"created_at":"2024-12-30T00:18:57.406Z","updated_at":"2026-04-28T12:03:12.485Z","avatar_url":"https://github.com/hamadrehman.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTML Page Translator\n\nA lightweight, efficient service that provides on-the-fly HTML page translation using Google Translate API. This project allows you to selectively translate specific HTML elements while preserving the original structure and styling of your web pages.\n\n## Features\n\n- **Selective Tag Translation**: Choose which HTML elements to translate (e.g., headings, paragraphs, links)\n- **Async Translation**: Utilizes asynchronous requests for improved performance\n- **Caching System**: Implements LRU caching to avoid redundant translations\n- **Language Support**: Supports all languages available through Google Translate\n- **Original File Preservation**: Maintains the original HTML structure and only modifies text content\n- **Fault Tolerance**: Includes error handling and logging for reliable operation\n\n## Installation \u0026 Setup\n\nYou have two options for running this service:\n\n### Option 1: Using Docker (Recommended)\n\n1. Make sure you have Docker and Docker Compose installed on your system\n2. Clone the repository\n3. Start the service:\n```bash\ndocker-compose up\n```\n\nThat's it! The service will be available at `http://localhost:80`\n\n### Option 2: Local Python Installation\n\n1. Clone the repository\n2. Install dependencies using pip:\n```bash\npip install -r requirements.txt\n```\n3. Start the server:\n```bash\npython serve.py\n```\n\n## Usage\n\n1. Place your HTML files in the `pages` directory\n\n2. Access your translated pages:\n```\nhttp://localhost:80/your-page.html?lang=es\u0026tags=title,h1,p\n```\n\n### URL Parameters\n\n- `lang`: Target language code (default: 'hi' for Hindi)\n  - Example: `lang=es` for Spanish, `lang=fr` for French\n- `tags`: Comma-separated list of HTML tags to translate (default: title,h1,h2,a)\n  - Example: `tags=p,h1,title,span`\n\n### Example\n\nTo translate only the headings and paragraphs of `about.html` to Spanish:\n```\nhttp://localhost:80/about.html?lang=es\u0026tags=h1,h2,h3,p\n```\n\n## Configuration\n\nThe service runs with these default settings:\n- Port: 80\n- Host: 0.0.0.0\n- Default language: Hindi (hi)\n- Default tags: title, h1, h2, a\n\n## Error Handling\n\nThe service includes comprehensive error handling:\n- Falls back to serving the original file if translation fails\n- Logs errors with detailed information\n- Skips empty elements and failed translations\n- Maintains page functionality even if some translations fail\n\n## Limitations\n\n- Relies on the free tier of Google Translate API\n- May have rate limiting based on Google's policies\n- Cached translations persist only during runtime\n\n## Contributing\n\nFeel free to open issues or submit pull requests with improvements. Some areas that could use enhancement:\n- Persistent caching system\n- Additional translation service providers\n- Custom rate limiting\n- Translation quality validation\n\n## License\n\nThis project is open source and available under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamadrehman%2Fflask-translation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhamadrehman%2Fflask-translation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamadrehman%2Fflask-translation/lists"}