{ "info": { "author": "Mitsuki Ogasahara", "author_email": "negiga@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12" ], "description": "# ailingo: A CLI tool for translating local files using generative AI (LLM)\n\n**ailingo** is a command-line interface (CLI) tool that uses generative AI to translate local files into various languages.\n\n

\n \n \"Releases\"\n \n \"CI\"\n \n \"MIT\n

\n\n

\n English |\n \u65e5\u672c\u8a9e |\n \u7b80\u4f53\u4e2d\u6587 |\n \u7e41\u4f53\u4e2d\u6587 |\n Espa\u00f1ol\n

\n\n## Overview\n\nIt is designed to enable developers, translators, and content creators to efficiently localize their files.\n\n**Key Features:**\n\n- **Flexible file handling:** Translate multiple files at once.\n- **Wide language support:** Freely specify the source and target languages.\n- **Generative AI model selection:** Choose from various generative AI models available through litellm, including ChatGPT, Gemini, and Anthropic.\n- **Customizable output:** Control the names and save locations of translated files.\n- **Adding translation requests**: Add requests for nuances in translation, such as casual tone.\n- **Rewrite mode**: Rewrite text in the same language with spelling/grammar correction or adjust the writing style as requested.\n- **Editor mode**: Translate text directly in an editor.\n- **URL mode**: Download and translate a web page. \n\n## Installation\n\n### Prerequisites:\n\n- Python 3.11\n\n## Quick Start:\n\n```bash\nexport OPENAI_API_KEY=\"YOUR_OPENAI_API_KEY\"\npip install ailingo\nailingo my_document.txt --target ja\n```\n\n### Detailed setup procedure:\n\n#### 1. Setting up litellm:\n\nThis program uses LiteLLM to access generative AI. LiteLLM is designed to work with a variety of providers. Please create an account with the provider of the generative AI model you wish to use, and obtain an API key.\n\nPlease refer to the [LiteLLM documentation](https://docs.litellm.ai/docs/providers) for detailed setup instructions. Here are some examples of setting up typical API keys:\n\n```bash\n# Default: OpenAI (gpt-4o, etc.)\nexport OPENAI_API_KEY=\"YOUR_OPENAI_API_KEY\"\n\n# VertexAI (Gemini, etc.)\n# Run `gcloud auth application-default login` or set `GOOGLE_APPLICATION_CREDENTIALS`\nexport VERTEXAI_PROJECT=\"your-google-project-id\"\nexport VERTEXAI_LOCATION=\"us-central1\"\n\n# Anthropic (haiku, opus, sonnet, etc.)\nexport ANTHROPIC_API_KEY=\"YOUR_ANTHROPIC_API_KEY\"\n```\n\n#### 2. Installing ailingo:\n\n```bash\npip install ailingo\n# If you want to use VertexAI (Gemini etc.)\npip install 'ailingo[google]'\n# If you want to use AWS (Bedrock)\npip install 'ailingo[aws]'\n# Or install all dependencies\npip install 'ailingo[all]'\n```\n\n## Usage\n\n### Basic translation:\n\n```bash\nailingo --target \n```\n\n### Example:\n\n```bash\nailingo my_document.txt --target ja\n```\n\nThis will translate `my_document.txt` into Japanese and save it as `my_document.ja.txt`. By default, it will be saved in the same folder in the format `{stem}.{target}{suffix}`.\n\n### File name estimation by specifying the source language:\n\n```bash\nailingo /path/to/en/my_document.txt --source en --target ja\n```\n\nThis will translate `my_document.txt` into Japanese and save it as `/path/to/ja/my_document.txt`. This feature replaces the source language code with the target language code if the file name or directory name contains the source language code.\n\n- Example: `document.en.txt` \u2192 `document.ja.txt`\n- Example: `locales/en/LC_MESSAGES/message.po` \u2192 `locales/ja/LC_MESSAGES/message.po`\n\nNote: This automatic estimation does not apply if you specify an output file name pattern with the `--output` option.\n\n### Multiple files and target languages:\n\n```bash\nailingo file1.txt file2.html --target ja,es,fr\n```\n\nThis will translate `file1.txt` and `file2.html` into Japanese, Spanish, and French.\n\n### Specifying additional translation requests:\n\n```bash\nailingo my_document.txt --target de --request \"Please make it as casual as possible, with some jokes in between.\"\n```\n\nThis will request to make the translation of `my_document.txt` into German as casual as possible, with some jokes added.\n\n### Rewrite mode: Modifying the style of the text in the same language\n\n```bash\nailingo my_document.txt\n```\n\nIf you do not specify a target language, the existing `my_document.txt` will be rewritten in the same language. Other options can be specified in the same way as for translation.\n\nBy default, it will correct spelling and grammatical errors, but you can also use the `--request` option to add more specific requests.\n\n### Editor mode: Translate without specifying a file\n\n```bash\nailingo -e\n```\n\nIn editor mode, a temporary file is opened in an editor (vi by default) for manual editing before translation. After editing, the saved content is used for translation.\n\nOther options can be used in combination:\n\n- The target language can be specified with `--target`.\n- Style modification requests can be added with `--request`.\n- The translation result is displayed on standard output by default, but an output file can be specified with `--output`.\n\n### URL mode: Translating web pages\n\n```bash\nailingo -u --target \n```\n\nIn URL mode, ailingo extracts the text content of the web page at the specified URL, translates it, and outputs it in Markdown format. \n\nOther options can be used in combination:\n\n### Specifying the Generative AI Model:\n\n```bash\nailingo my_document.txt --target de --model gemini-1.5-pro\n```\n\nThis will translate `my_document.txt` into German using Google Gemini Pro.\n\n### Streaming Output (Experimental)\n\n```bash\nailingo my_document.txt --target ja --stream\n```\n\nThe `--stream` option enables streaming output, which displays the translation results in real time. Streaming output is disabled by default.\n\n### Customizing the output file name:\n\n```bash\nailingo my_document.txt --target es --output \"{parent}/{stem}_translated.{target}{suffix}\"\n```\n\nThis will translate `my_document.txt` into Spanish and save it as `my_document_translated.es.txt`.\n\n```bash\nailingo /path/to/en/my_document.txt --target ja --output \"{parents[1]}/{target}/{name}\"\n```\n\nThis will translate `path/to/en/my_document.txt` into Japanese and save it as `path/to/ja/my_document.txt`.\n\nThe string specified for `--output` is interpreted by the [format function](https://docs.python.org/3.11/tutorial/inputoutput.html). The following variables are available:\n\n| Variable Name | Value | Type | Example |\n|:------------|:----------------------------------------------------------|:--------------|:------------------------------|\n| `{stem}` | Part of the input file excluding the extension | `str` | `my_document` |\n| `{suffix}` | Extension of the input file (including the dot) | `str` | `.txt` |\n| `{suffixes}` | List of extensions of the input file (including the dot) | `list[str]` | `['.ja', '.txt']` |\n| `{name}` | File name of the input file including the extension | `str` | `my_document.txt` |\n| `{parent}` | Parent directory of the input file | `str` | `/path/to/en` |\n| `{parents}` | List of parent directories of the input file | `list[str]` | `['/path/to', '/path']` |\n| `{target}` | Target language | `str` | `ja` |\n| `{source}` | Source language (only if specified) | `Optional[str]` | `en` |\n\nFor other variables, please refer to the [Pathlib documentation](https://docs.python.org/3/library/pathlib.html#methods-and-properties).\n\n### Detailed options:\n\nFor more advanced usage, please use the help command:\n\n```bash\nailingo --help\n```\n\n## License\n\nThis project is distributed under the MIT License.\n\n## Disclaimer\n\nThis tool utilizes generative AI, but the quality of the translation depends on the selected AI model and input text. It is recommended to review the translation results and make corrections as needed.\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "dynamic": null, "home_page": null, "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "ailingo", "package_url": "https://pypi.org/project/ailingo/", "platform": null, "project_url": "https://pypi.org/project/ailingo/", "project_urls": null, "provides_extra": null, "release_url": "https://pypi.org/project/ailingo/0.4.0/", "requires_dist": [ "anthropic[vertex]<0.29.0,>=0.28.0; extra == \"anthropic-vertex\" or extra == \"all\"", "boto3>=1.28.57; extra == \"aws\" or extra == \"all\"", "google-cloud-aiplatform<2.0.0,>=1.52.0; extra == \"google\" or extra == \"all\"", "google-generativeai<0.6.0,>=0.5.4; extra == \"google\" or extra == \"all\"", "instructor<2.0.0,>=1.3.2", "jinja2<4.0.0,>=3.1.4", "litellm<2.0.0,>=1.38.8", "lxml-html-clean<0.2.0,>=0.1.1", "requests-html<0.11.0,>=0.10.0", "rich<14.0.0,>=13.7.1", "typer<0.13.0,>=0.12.3" ], "requires_python": "<4.0,>=3.11", "summary": "A CLI Tool for Local File Translation Using Generative AI(LLMs)", "version": "0.4.0", "yanked": false, "yanked_reason": null }, "last_serial": 23887233, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "blake2b_256": "b17a056dd235f18c62f0aa675aeeb7d1c16478e593d552be4bdca493e46b1e58", "md5": "9d45f220587338eea36290f0bee67dee", "sha256": "a0e712fefd5200ab51495037a74a17824da89532f9f20f5187e20cf144735eb4" }, "downloads": -1, "filename": "ailingo-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9d45f220587338eea36290f0bee67dee", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "<4.0,>=3.11", "size": 10007, "upload_time": "2024-05-27T13:45:20", "upload_time_iso_8601": "2024-05-27T13:45:20.086469Z", "url": "https://files.pythonhosted.org/packages/b1/7a/056dd235f18c62f0aa675aeeb7d1c16478e593d552be4bdca493e46b1e58/ailingo-0.1.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "blake2b_256": "9bde6bdaf35c7324a348815118a6103ac16c23acfcd9c877df1259a2fa810237", "md5": "652c86a74c24405e4f58ab76a6a8a0ea", "sha256": "9190c16574ca89f708f5e30f6fe78be4bdcdbe57df796040437f55754399e039" }, "downloads": -1, "filename": "ailingo-0.1.0.tar.gz", "has_sig": false, "md5_digest": "652c86a74c24405e4f58ab76a6a8a0ea", "packagetype": "sdist", "python_version": "source", "requires_python": "<4.0,>=3.11", "size": 10407, "upload_time": "2024-05-27T13:45:25", "upload_time_iso_8601": "2024-05-27T13:45:25.008547Z", "url": "https://files.pythonhosted.org/packages/9b/de/6bdaf35c7324a348815118a6103ac16c23acfcd9c877df1259a2fa810237/ailingo-0.1.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.1": [ { "comment_text": "", "digests": { "blake2b_256": "a84a48dafbab25e88dd930254c7ea39b1fa517c65c5dc46de51394a802034ef5", "md5": "54b26e24a9ddce2d151a3ad8b0e09807", "sha256": "addb1791b880b3bc86bc7635881305cc0b85248d1b473dc51bd8b545ec65dfec" }, "downloads": -1, "filename": "ailingo-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "54b26e24a9ddce2d151a3ad8b0e09807", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "<4.0,>=3.11", "size": 10387, "upload_time": "2024-05-27T15:02:09", "upload_time_iso_8601": "2024-05-27T15:02:09.720599Z", "url": "https://files.pythonhosted.org/packages/a8/4a/48dafbab25e88dd930254c7ea39b1fa517c65c5dc46de51394a802034ef5/ailingo-0.1.1-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "blake2b_256": "6d5b9ede95147a6db8d8d0c8c84982c2fb213a7cdab1da4ad6004d39735fe3d5", "md5": "36811d2de5bb664664b4c62aa1f1c0a7", "sha256": "71afc2574f11778b0c8dcd78e7d338f9d53f06c110663154324741599eed1b09" }, "downloads": -1, "filename": "ailingo-0.1.1.tar.gz", "has_sig": false, "md5_digest": "36811d2de5bb664664b4c62aa1f1c0a7", "packagetype": "sdist", "python_version": "source", "requires_python": "<4.0,>=3.11", "size": 11080, "upload_time": "2024-05-27T15:02:11", "upload_time_iso_8601": "2024-05-27T15:02:11.261193Z", "url": "https://files.pythonhosted.org/packages/6d/5b/9ede95147a6db8d8d0c8c84982c2fb213a7cdab1da4ad6004d39735fe3d5/ailingo-0.1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.3": [ { "comment_text": "", "digests": { "blake2b_256": "a7ff32dc28b2f70cd9b01531ce4ef34760e7e0850bd5118124c1b1fd49a7c6d9", "md5": "9b3e679bb16552fb20f3f757ac72ab74", "sha256": "b3aa97f746ebfe460bdd4130e133dcd1550433418997120bc17cb78e97d8e861" }, "downloads": -1, "filename": "ailingo-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "9b3e679bb16552fb20f3f757ac72ab74", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "<4.0,>=3.11", "size": 10586, "upload_time": "2024-06-01T05:37:32", "upload_time_iso_8601": "2024-06-01T05:37:32.093775Z", "url": "https://files.pythonhosted.org/packages/a7/ff/32dc28b2f70cd9b01531ce4ef34760e7e0850bd5118124c1b1fd49a7c6d9/ailingo-0.1.3-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "blake2b_256": "a02bbea6c3d6e9d289c6a43a58b338bd8d9ae94652904156cd0db7e3033a12bb", "md5": "7f4402bf279f9d5491aa379d37a3ae9b", "sha256": "7634ada278a10a5c8f268f2f8b52e53c5ff07bfff133f6b74d18445c7aa9bb46" }, "downloads": -1, "filename": "ailingo-0.1.3.tar.gz", "has_sig": false, "md5_digest": "7f4402bf279f9d5491aa379d37a3ae9b", "packagetype": "sdist", "python_version": "source", "requires_python": "<4.0,>=3.11", "size": 11413, "upload_time": "2024-06-01T05:37:33", "upload_time_iso_8601": "2024-06-01T05:37:33.077771Z", "url": "https://files.pythonhosted.org/packages/a0/2b/bea6c3d6e9d289c6a43a58b338bd8d9ae94652904156cd0db7e3033a12bb/ailingo-0.1.3.tar.gz", "yanked": false, "yanked_reason": null } ], "0.2.0": [ { "comment_text": "", "digests": { "blake2b_256": "4e9364adfe8192659c555a60388b487f0a27f53dd29f557871ea745c0da07ec5", "md5": "01f995aa350278ea19311d6cd818274c", "sha256": "00f3a7d31defa47e845e323739c8e1f84026ae2913e06169e18f8107bcb5bb3c" }, "downloads": -1, "filename": "ailingo-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "01f995aa350278ea19311d6cd818274c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "<4.0,>=3.11", "size": 11109, "upload_time": "2024-06-01T08:32:39", "upload_time_iso_8601": "2024-06-01T08:32:39.132942Z", "url": "https://files.pythonhosted.org/packages/4e/93/64adfe8192659c555a60388b487f0a27f53dd29f557871ea745c0da07ec5/ailingo-0.2.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "blake2b_256": "d559a129476bfd51a69676376b030f999d9808f6eb251a38e49d84eb2b643ee8", "md5": "d7c05502c4c8956884ffdf8b66522146", "sha256": "a155cd017abeb3c69f4cdc47397703df59477763ac05ec4b4b63527a1d021dc6" }, "downloads": -1, "filename": "ailingo-0.2.0.tar.gz", "has_sig": false, "md5_digest": "d7c05502c4c8956884ffdf8b66522146", "packagetype": "sdist", "python_version": "source", "requires_python": "<4.0,>=3.11", "size": 11838, "upload_time": "2024-06-01T08:32:40", "upload_time_iso_8601": "2024-06-01T08:32:40.642079Z", "url": "https://files.pythonhosted.org/packages/d5/59/a129476bfd51a69676376b030f999d9808f6eb251a38e49d84eb2b643ee8/ailingo-0.2.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.3.0": [ { "comment_text": "", "digests": { "blake2b_256": "9d8964ceec256229b0b7ac4d0dd8663488014edd59a5403c1f9f0ac7f27814be", "md5": "eb02b2a9e5b52ed1bddd941e4e5a895e", "sha256": "10ab69777b1f267941d5127cf356fcb9d4cb84988c38b2cc48a2c6fad570be0f" }, "downloads": -1, "filename": "ailingo-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "eb02b2a9e5b52ed1bddd941e4e5a895e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "<4.0,>=3.11", "size": 15073, "upload_time": "2024-06-28T00:54:33", "upload_time_iso_8601": "2024-06-28T00:54:33.629832Z", "url": "https://files.pythonhosted.org/packages/9d/89/64ceec256229b0b7ac4d0dd8663488014edd59a5403c1f9f0ac7f27814be/ailingo-0.3.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "blake2b_256": "771db97574e47fa9870ac3826bd4e40e3c29a8a44861cffa1cf71938fd532d29", "md5": "654b67a2f545f88b1f34532f59e4f614", "sha256": "01e00068265d3778ced19d671ef792c8e83a146dfafd5722f061eee5cf9d9c9c" }, "downloads": -1, "filename": "ailingo-0.3.0.tar.gz", "has_sig": false, "md5_digest": "654b67a2f545f88b1f34532f59e4f614", "packagetype": "sdist", "python_version": "source", "requires_python": "<4.0,>=3.11", "size": 13367, "upload_time": "2024-06-28T00:54:35", "upload_time_iso_8601": "2024-06-28T00:54:35.030683Z", "url": "https://files.pythonhosted.org/packages/77/1d/b97574e47fa9870ac3826bd4e40e3c29a8a44861cffa1cf71938fd532d29/ailingo-0.3.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.4.0": [ { "comment_text": "", "digests": { "blake2b_256": "5ac90577c93cedb41ed770d5fd703321dfa7b6ca0a107c210f2cc8e68ac62937", "md5": "ddef5bcda6cb927e3d2d7d8540d6e992", "sha256": "e59754242f71cf4f98f55fcec11965808aec4411eb0424862a89782f081e6ead" }, "downloads": -1, "filename": "ailingo-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ddef5bcda6cb927e3d2d7d8540d6e992", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "<4.0,>=3.11", "size": 15488, "upload_time": "2024-06-28T00:57:47", "upload_time_iso_8601": "2024-06-28T00:57:47.421999Z", "url": "https://files.pythonhosted.org/packages/5a/c9/0577c93cedb41ed770d5fd703321dfa7b6ca0a107c210f2cc8e68ac62937/ailingo-0.4.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "blake2b_256": "920f3eeb2d62c1ca1fecd3df0d20896184d95f0ec29fbbe23679cd9927a6f072", "md5": "84f30c48aeba8aeae31cb3cf1621e5c2", "sha256": "2821d7f8deb6b75a296d3152e427e2d85e31c7e213e708f5f4989907c1264712" }, "downloads": -1, "filename": "ailingo-0.4.0.tar.gz", "has_sig": false, "md5_digest": "84f30c48aeba8aeae31cb3cf1621e5c2", "packagetype": "sdist", "python_version": "source", "requires_python": "<4.0,>=3.11", "size": 13748, "upload_time": "2024-06-28T00:57:48", "upload_time_iso_8601": "2024-06-28T00:57:48.764815Z", "url": "https://files.pythonhosted.org/packages/92/0f/3eeb2d62c1ca1fecd3df0d20896184d95f0ec29fbbe23679cd9927a6f072/ailingo-0.4.0.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "blake2b_256": "5ac90577c93cedb41ed770d5fd703321dfa7b6ca0a107c210f2cc8e68ac62937", "md5": "ddef5bcda6cb927e3d2d7d8540d6e992", "sha256": "e59754242f71cf4f98f55fcec11965808aec4411eb0424862a89782f081e6ead" }, "downloads": -1, "filename": "ailingo-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ddef5bcda6cb927e3d2d7d8540d6e992", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "<4.0,>=3.11", "size": 15488, "upload_time": "2024-06-28T00:57:47", "upload_time_iso_8601": "2024-06-28T00:57:47.421999Z", "url": "https://files.pythonhosted.org/packages/5a/c9/0577c93cedb41ed770d5fd703321dfa7b6ca0a107c210f2cc8e68ac62937/ailingo-0.4.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "blake2b_256": "920f3eeb2d62c1ca1fecd3df0d20896184d95f0ec29fbbe23679cd9927a6f072", "md5": "84f30c48aeba8aeae31cb3cf1621e5c2", "sha256": "2821d7f8deb6b75a296d3152e427e2d85e31c7e213e708f5f4989907c1264712" }, "downloads": -1, "filename": "ailingo-0.4.0.tar.gz", "has_sig": false, "md5_digest": "84f30c48aeba8aeae31cb3cf1621e5c2", "packagetype": "sdist", "python_version": "source", "requires_python": "<4.0,>=3.11", "size": 13748, "upload_time": "2024-06-28T00:57:48", "upload_time_iso_8601": "2024-06-28T00:57:48.764815Z", "url": "https://files.pythonhosted.org/packages/92/0f/3eeb2d62c1ca1fecd3df0d20896184d95f0ec29fbbe23679cd9927a6f072/ailingo-0.4.0.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }