{"id":27290964,"url":"https://github.com/kabeep/node-translate-cli","last_synced_at":"2025-04-11T21:39:47.141Z","repository":{"id":238726040,"uuid":"797373601","full_name":"kabeep/node-translate-cli","owner":"kabeep","description":"\u003e A powerful, secure and feature-rich tool via Google Translation in terminal._","archived":false,"fork":false,"pushed_at":"2025-01-09T04:18:28.000Z","size":1952,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T22:51:16.714Z","etag":null,"topics":["google-translate","google-translate-cli","node-cli","node-translate","node-translate-cli","nodejs","translate","translate-cli"],"latest_commit_sha":null,"homepage":"https://github.com/kabeep/node-translate-cli","language":"TypeScript","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/kabeep.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-05-07T17:48:44.000Z","updated_at":"2025-01-09T04:18:32.000Z","dependencies_parsed_at":"2024-05-10T20:21:45.609Z","dependency_job_id":"b594160c-6bde-486b-85a6-b64af5f32b23","html_url":"https://github.com/kabeep/node-translate-cli","commit_stats":null,"previous_names":["kabeep/node-translate-cli"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fnode-translate-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fnode-translate-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fnode-translate-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fnode-translate-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kabeep","download_url":"https://codeload.github.com/kabeep/node-translate-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248485767,"owners_count":21111921,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["google-translate","google-translate-cli","node-cli","node-translate","node-translate-cli","nodejs","translate","translate-cli"],"created_at":"2025-04-11T21:39:43.096Z","updated_at":"2025-04-11T21:39:47.121Z","avatar_url":"https://github.com/kabeep.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg width=\"630\" src=\"docs/images/logo.png\" alt=\"logo\"\u003e\n\nA powerful, secure and feature-rich **command line** via Google Translation.\n\n[![NodeJS](https://img.shields.io/node/v/%40kabeep%2Fnode-translate-cli?color=lightseagreen)](https://nodejs.org/docs/latest/api/)\n[![License](https://img.shields.io/github/license/kabeep/node-translate-cli?color=slateblue)](LICENSE)\n[![NPM](https://img.shields.io/npm/d18m/%40kabeep%2Fnode-translate-cli?color=cornflowerblue)](https://www.npmjs.com/package/@kabeep/node-translate-cli)\n[![Codecov](https://img.shields.io/codecov/c/github/kabeep/node-translate-cli?logo=codecov\u0026color=mediumvioletred)](https://codecov.io/gh/kabeep/node-translate-cli)\n[![Codacy](https://img.shields.io/codacy/grade/2cf61fce83694f82a0a9213ac8d9a796?logo=codacy\u0026logoColor=dodgerblue\u0026color=dodgerblue)](https://app.codacy.com/gh/kabeep/node-translate-cli/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![CircleCI](https://dl.circleci.com/status-badge/img/circleci/Qh23T2Zgw4Fy4V8uvKaymp/XWLHQrsMmQsM3jydfFa2AW/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/circleci/Qh23T2Zgw4Fy4V8uvKaymp/XWLHQrsMmQsM3jydfFa2AW/tree/master)\n\nEnglish | [简体中文](README.zh-CN.md)\n\n![Alt](https://repobeats.axiom.co/api/embed/f0b1b8b0150e5f891d765081ad1349cccc127c5c.svg \"Repobeats analytics image\")\n\n\u003cimg width=\"814\" src=\"docs/images/preview.png\" alt=\"usage-png\"\u003e\n\n\u003c/div\u003e\n\n## 📖 Introduction\n\n\u003e Using the [node-translate](https://github.com/kabeep/node-translate) API in the terminal.\n\u003e\n\u003e The API bypasses token restrictions.\n\u003e If it is used in large quantities or for business, please support the work of\n\u003e Google Translation, which provides a lot of free credits.\n\n#### Besides simple text translation, it also provides:\n\n- Auto-detect system language as target language\n- Spell autocorrect\n- Getting source text from stdin\n- Polysemous translation results\n- Synonyms of the source text\n- Example sentences of the source text\n- Phonetic transcription of the source and translated text\n- Stable output and error prompts\n- Beautiful terminal styling\n- Internationalized prompt for terminal\n\n## ⚙️ Installation\n\n```bash\nnpm install @kabeep/node-translate-cli --save\n```\n\n```bash\nyarn add @kabeep/node-translate-cli\n```\n\n```bash\npnpm add @kabeep/node-translate-cli\n```\n\n## 🚀 Usage\n\n```text\ntranslate \u003ctext\u003e [options]\n\noptions：\n  -f, --from            The source language (language to be translated from)\n                        specified as language name or ISO 639-1 code\n                                                           [string] [default: \"auto\"]\n  -t, --to              The target language (language to be translated to)\n                        specified as language name or ISO 639-1 code\n                                                           [string] [default: \"auto\"]\n      --timeout         Timeout duration for the translation request in\n                        milliseconds                       [number] [default: 30000]\n      --stdin-timeout   You can use this parameter to avoid timeouts if stdin\n                        takes too long (ms)                [number] [default: 5000]\n  -r, --retry           Retry attempts for the translation request in case of\n                        failure                            [number] [default: 0]\n  -p, --show-phonetics  Show the pronunciation of the translated word\n                                                           [boolean] [default: false]\n  -s, --show-source     Show source text information       [boolean] [default: false]\n  -d, --show-detail     Show translated detail information [boolean] [default: false]\n  -l, --show-list       Show supported language list       [boolean] [default: false]\n      --show-code       Show supported language code list  [boolean] [default: false]\n      --show-adaptive   Show adaptive language             [boolean] [default: false]\n  -v, --version         Show version                       [boolean]\n  -h, --help            Show help info                     [boolean]\n```\n\n## 🪄 Examples\n\n#### Using stdin\n\n```shell\necho \"test\" | translate -f en -t zh\n```\n\n#### Using iso-639-1 and text parameters\n\n```shell\ntranslate \"test\" --from=en --to=zh\n```\n\n#### Using language name and capitalized correction\n\n```shell\ntranslate \"test\" --from=\"ENGLISH\" --to=\"chinese\"\n```\n\n#### Adaptive source language\n\n```shell\ntranslate \"test\" -t zh\n```\n\n#### Self-detection of native language\n\n```shell\ntranslate \"test\" -f en\n```\n\n#### Autocorrect source text\n\n```shell\ntranslate \"Thunk you\"\n```\n\n#### Translate words and show synonyms, polysemy explanations and examples\n\n```shell\ntranslate \"test\" -d\n```\n\n#### Translate a word, phrase or sentence and show the source text and phonetic symbols\n\n```shell\ntranslate \"test\" -s -p\n```\n\n#### Set API timeout\n\n```shell\ntranslate \"test\" --timeout=60000\n```\n\n#### Set the timeout for the standard input stream\n\n```shell\nnpm view node-translate-cli description | translate --stdin-timeout=30000\n```\n\n#### Set the number of retries when an API request fails\n\n```shell\ntranslate \"test\" -r 2\n```\n\n#### Show supported languages\n\n```shell\ntranslate -l\n```\n\n#### Show supported language codes\n\n```shell\ntranslate --show-code\n```\n\n#### Show supported adaptive languages\n\n```shell\ntranslate --show-adaptive\n```\n\n#### Show help information\n\n```shell\ntranslate -h\n```\n\n#### Show the version of current\n\n```shell\ntranslate -v\n```\n\n## 🧙🏽‍♂️ Advanced\n\n#### Using another npm package\n\n```shell\nnpm install -g clipboard-cli\n\n# Use the clipboard-cli to copy translation results to the clipboard\ntranslate 'Translate this sentence to your clipboard' | clipboard\n```\n\n#### Using the static accessor `$()` method\n\n```shell\ngit commit -m \"$(translate 'feat: your commit content' -t zh)\"\n```\n\n![Alt](docs/images/advanced-usage-accessor.png \"Using the static accessor method\")\n\n#### Using the pipe `|` symbol\n\n```shell\nnpm info npm description | translate -t zh\n```\n\n![Alt](docs/images/advanced-usage-pipe.png \"Using the pipe | symbol\")\n\n#### Using the redirection `\u003e` symbol\n\n```shell\ntranslate \"这是一段测试文本。\" -t en \u003e usage.txt\n```\n\n![Alt](docs/images/advanced-usage-redirection.png \"Using the redirection \u003e symbol\")\n\n## 🔧 Autocorrect\n\n\u003e Default: white background\n\u003e\n\u003e Correct Spelling: yellow background\n\u003e\n\u003e Detect Language: red background\n\n![Alt](docs/images/autocorrect.png \"Color Scheme\")\n\n## 🐢 Network anomaly\n\n\u003e When the network is abnormal, the terminal will change as shown in the figure below\n\u003e (they actually come from the same line).\n\n![Alt](docs/images/slowly-network.png \"Stdout in Terminal\")\n\n## ⌨️ Automatic line wrapping\n\n\u003e When a single line of content is too long, the terminal will automatically wrap the line after the title.\n\n![Alt](docs/images/newline.png \"Overlong text\")\n\n## 🌐 i18n\n\nQuickly contribute your language via ease-to-use [node-translate-i18n](https://github.com/kabeep/node-translate-i18n)\nin [locale](https://github.com/kabeep/node-translate-cli/tree/master/src/locale/index.ts) file are welcome,\nor notify me via [Issues](https://github.com/kabeep/node-translate-cli/issues) for handling.\n\n![Alt](docs/images/i18n.png \"Locale from OS\")\n\n## 🔗 Related\n\n- [node-translate](https://github.com/kabeep/node-translate) - 🦜 A powerful, secure and feature-rich api via Google\n  Translation.\n- [node-translate-i18n](https://github.com/kabeep/node-translate-i18n) - 🌏 A command-line interface tool for translating\n  localization files to other languages.\n- [google-translate-cli](https://github.com/jesusalber1/google-translate-cli) - Google Translate via CLI.\n\n## 🤝 Contribution\n\nContributions via Pull Requests or [Issues](https://github.com/kabeep/node-translate-cli/issues) are welcome.\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabeep%2Fnode-translate-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkabeep%2Fnode-translate-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabeep%2Fnode-translate-cli/lists"}