{"id":27961790,"url":"https://github.com/redpiarofficial/aitranslator","last_synced_at":"2026-02-21T20:03:48.151Z","repository":{"id":288763145,"uuid":"969100676","full_name":"RedPiarOfficial/AiTranslator","owner":"RedPiarOfficial","description":"A powerful Python library for accessing multiple translation services through a unified API.","archived":false,"fork":false,"pushed_at":"2025-04-19T13:31:07.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-20T13:50:56.526Z","etag":null,"topics":["ai","amazon","deepl","google","libre","modern","python","translator"],"latest_commit_sha":null,"homepage":"","language":"Python","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/RedPiarOfficial.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,"zenodo":null}},"created_at":"2025-04-19T11:41:31.000Z","updated_at":"2025-06-11T15:50:58.000Z","dependencies_parsed_at":"2025-04-19T17:25:04.555Z","dependency_job_id":"c8f04108-93e1-4eb4-ad7f-e67ca2339642","html_url":"https://github.com/RedPiarOfficial/AiTranslator","commit_stats":null,"previous_names":["redpiarofficial/aitranslator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RedPiarOfficial/AiTranslator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedPiarOfficial%2FAiTranslator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedPiarOfficial%2FAiTranslator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedPiarOfficial%2FAiTranslator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedPiarOfficial%2FAiTranslator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RedPiarOfficial","download_url":"https://codeload.github.com/RedPiarOfficial/AiTranslator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedPiarOfficial%2FAiTranslator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29691947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T18:18:25.093Z","status":"ssl_error","status_checked_at":"2026-02-21T18:18:22.435Z","response_time":107,"last_error":"SSL_read: 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":["ai","amazon","deepl","google","libre","modern","python","translator"],"created_at":"2025-05-07T19:12:08.484Z","updated_at":"2026-02-21T20:03:48.132Z","avatar_url":"https://github.com/RedPiarOfficial.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Translator\n\nA powerful Python library for accessing multiple translation services through a unified API.\n\n## Table of Contents\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Core Features](#core-features)\n- [Translation Services](#translation-services)\n- [Language Detection](#language-detection)\n- [API Reference](#api-reference)\n- [Examples](#examples)\n- [Error Handling](#error-handling)\n- [Limitations](#limitations)\n\n## Installation\n\n```bash\npip install translatorai\n```\n\n## Quick Start\n\n```python\nfrom translatorai import Translator\n\n# Initialize the translator\ntranslator = Translator()\n\n# Translate text from auto-detected language to English\nresult = translator.google(\"Привет, мир!\", \"en\")\nprint(result['response']['translated_text'])  # Output: \"Hello, world!\"\n```\n\n## Core Features\n\n- Access to 5 different translation services via a unified API\n- Automatic language detection\n- Support for specific source and target languages\n- Error handling with appropriate HTTP status codes\n- JSON response format for easy integration\n\n## Translation Services\n\nThe library provides access to the following translation engines:\n\n| Method | Service | Description |\n|--------|---------|-------------|\n| `google()` | Google Translate | Google's neural machine translation service |\n| `deepl()` | DeepL | Highly accurate translation service known for natural-sounding results |\n| `amazon()` | Amazon Translate | Amazon Web Services' neural machine translation service |\n| `modern_mt()` | ModernMT | Adaptive neural machine translation |\n| `libre()` | LibreTranslate | Open-source machine translation |\n\n## Language Detection\n\nThe library includes automatic language detection which can be used both as a standalone feature and as part of the translation process.\n\n```python\n# Detect language\ndetection = translator.detect(\"こんにちは\")\nprint(detection[\"data\"][\"language_probability\"][\"code\"])  # Output: \"ja\"\n```\n\n## API Reference\n\n### Translator Class\n\n```python\nTranslator()\n```\n\nInitializes a new translator instance.\n\n### Translation Methods\n\nEach translation method follows the same signature:\n\n```python\ndef method_name(text, target, source='auto')\n```\n\n- `text` (str): The text to translate\n- `target` (str): Target language code (e.g., \"en\", \"fr\", \"de\")\n- `source` (str, optional): Source language code. Defaults to 'auto' for automatic detection.\n\nReturns a JSON object with translation results.\n\n### Available Methods\n\n#### Google Translate\n\n```python\ntranslator.google(text, target, source='auto')\n```\n\n#### DeepL\n\n```python\ntranslator.deepl(text, target, source='auto')\n```\n\n#### Amazon Translate\n\n```python\ntranslator.amazon(text, target, source='auto')\n```\n\n#### ModernMT\n\n```python\ntranslator.modern_mt(text, target, source='auto')\n```\n\n#### LibreTranslate\n\n```python\ntranslator.libre(text, target, source='auto')\n```\n\n#### Language Detection\n\n```python\ntranslator.detect(text)\n```\n\n- `text` (str): The text to analyze (only first 100 characters are used)\n\nReturns a JSON object with detected language information.\n\n## Examples\n\n### Translating with Different Services\n\n```python\ntranslator = Translator()\n\n# Original text\ntext = \"La vie est belle\"\n\n# Translate with different services\ngoogle_result = translator.google(text, \"en\", \"fr\")\ndeepl_result = translator.deepl(text, \"en\", \"fr\") \namazon_result = translator.amazon(text, \"en\", \"fr\")\n\nprint(f\"Google: {google_result['response']['translated_text']}\")\nprint(f\"DeepL: {deepl_result['response']['translated_text']}\")\nprint(f\"Amazon: {amazon_result['response']['translated_text']}\")\n```\n\n### Using Auto-Detection\n\n```python\n# The source language will be automatically detected\nresult = translator.google(\"Guten Tag\", \"en\")\nprint(result['response']['translated_text'])  # Output: \"Good day\"\n```\n\n## Error Handling\n\nThe library uses the `raise_for_status()` method from the requests library to handle HTTP errors. If the translation service returns a non-200 response, an exception will be raised.\n\n```python\ntry:\n    result = translator.google(\"Hello world\", \"invalid_language_code\")\nexcept requests.exceptions.HTTPError as e:\n    print(f\"An error occurred: {e}\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredpiarofficial%2Faitranslator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredpiarofficial%2Faitranslator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredpiarofficial%2Faitranslator/lists"}