{"id":15713623,"url":"https://github.com/kojix2/deepl-cli","last_synced_at":"2025-10-11T17:27:05.125Z","repository":{"id":153079398,"uuid":"619544252","full_name":"kojix2/deepl-cli","owner":"kojix2","description":"A fast and lightweight CLI for DeepL","archived":false,"fork":false,"pushed_at":"2025-08-11T03:52:36.000Z","size":1575,"stargazers_count":41,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-11T04:09:12.768Z","etag":null,"topics":["cli","crystal","crystal-lang","deepl","terminal","translation","translations","translator"],"latest_commit_sha":null,"homepage":"https://kojix2.github.io/deepl-cli/","language":"Crystal","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/kojix2.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"ko_fi":"kojix2"}},"created_at":"2023-03-27T10:57:32.000Z","updated_at":"2025-08-11T03:52:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"b8755fff-13bc-4591-a3f5-01d380fb7dfb","html_url":"https://github.com/kojix2/deepl-cli","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/kojix2/deepl-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kojix2%2Fdeepl-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kojix2%2Fdeepl-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kojix2%2Fdeepl-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kojix2%2Fdeepl-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kojix2","download_url":"https://codeload.github.com/kojix2/deepl-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kojix2%2Fdeepl-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273100478,"owners_count":25045697,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cli","crystal","crystal-lang","deepl","terminal","translation","translations","translator"],"created_at":"2024-10-03T21:32:32.072Z","updated_at":"2025-10-11T17:27:00.074Z","avatar_url":"https://github.com/kojix2.png","language":"Crystal","funding_links":["https://ko-fi.com/kojix2"],"categories":[],"sub_categories":[],"readme":"# DeepL CLI\n\n[![build](https://github.com/kojix2/deepl-cli/actions/workflows/build.yml/badge.svg)](https://github.com/kojix2/deepl-cli/actions/workflows/build.yml)\n[![Lines of Code](https://img.shields.io/endpoint?url=https%3A%2F%2Ftokei.kojix2.net%2Fbadge%2Fgithub%2Fkojix2%2Fdeepl-cli%2Flines)](https://tokei.kojix2.net/github/kojix2/deepl-cli)\n\nDeepL CLI is a fast and lightweight command-line tool for the [DeepL API](https://www.deepl.com/pro-api/), written in [Crystal](https://github.com/crystal-lang/crystal).\n\n- Supports document translation `pdf`, `docx`, `txt`, etc.\n- Supports glossaries\n- Precompiled binaries available\n\n## Installation\n\n### Download\n\n- Download the binary from the [Releases](https://github.com/kojix2/deepl-cli/releases)\n\n### Homebrew\n\n[![deepl-cli (macos)](https://github.com/kojix2/homebrew-brew/actions/workflows/deepl-cli-macos.yml/badge.svg)](https://github.com/kojix2/homebrew-brew/actions/workflows/deepl-cli-macos.yml)\n[![deepl-cli (ubuntu)](https://github.com/kojix2/homebrew-brew/actions/workflows/deepl-cli-ubuntu.yml/badge.svg)](https://github.com/kojix2/homebrew-brew/actions/workflows/deepl-cli-ubuntu.yml)\n\n```sh\nbrew install kojix2/brew/deepl-cli\n```\n\n### Proxy settings (optional)\n\n```sh\nexport HTTP_PROXY=http://[IP]:[port]\nexport HTTPS_PROXY=https://[IP]:[port]\n```\n\n## Prerequisites\n\nYou will need an API key for DeepL. [Create one here](https://www.deepl.com/pro-api) and set it as an environment variable:\n\n```sh\nexport DEEPL_AUTH_KEY=your_api_key_here\n```\n\n## Usage\n\n```sh\ndeepl [options] \u003cfile\u003e\n```\n\n### Translate text\n\n```sh\ndeepl [options] \u003cfile\u003e\n```\n\nOptions:\n\n```txt\n    -i, --input TEXT                 Input text\n    -f, --from [LANG]                Source language [AUTO]\n    -t, --to [LANG]                  Target language [EN]\n    -p, --paste                      Input text from clipboard\n    -g, --glossary NAME              Glossary name\n    -F, --formality OPT              Formality (default more less)\n    -C, --context TEXT               Context (experimental)\n    -S, --split-sentences OPT        Split sentences\n    -A, --ansi                       Do not remove ANSI escape codes\n```\n\nNote: ANSI escape sequences are removed by default.\n\n### Translate documents\n\nTo translate a document, use the `doc` subcommand:\n\n```sh\ndeepl doc [options] \u003cfile\u003e\n```\n\nOptions for document translation:\n\n```txt\n    -f, --from [LANG]                Source language [AUTO]\n    -t, --to [LANG]                  Target language [EN]\n    -g, --glossary NAME              Glossary name\n    -F, --formality OPT              Formality (default more less)\n    -o, --output FILE                Output file\n    -O, --output-format FORMAT       Output file format\n```\n\nSupported file formats.\n\n- `docx` - Microsoft Word Document\n- `pptx` - Microsoft PowerPoint Document\n- `xlsx` - Microsoft Excel Document\n- `pdf` - Portable Document Format\n- `htm` / `html` - HTML Document\n- `txt` - Plain Text Document\n- `xlf` / `xliff` - XLIFF Document, version 2.1\n\n### Manage glossaries\n\nFor glossary management, use the `glossary` subcommand:\n\n```sh\ndeepl glossary [options]\n```\n\nOptions for glossary management:\n\n```txt\n    list                             List glossaries\n    create                           Create a glossary\n    delete                           Delete glossaries\n    edit                             Edit glossaries\n    view                             View glossaries\n    -l, --list                       List glossaries\n    -p, --language-pairs             List language pairs\n```\n\n### Improve text (Rephrase)\n\nUse the `rephrase` subcommand to rewrite text in different styles or tones.\n\n```sh\nUsage: deepl rephrase [options] \u003cfile\u003e\n```\n\nOptions for rephrase:\n\n```txt\n    -i, --input TEXT                 Input text\n    -s, --writing-style STYLE        academic business casual default simple\n    -t, --tone TONE                  confident diplomatic enthusiastic friendly\n```\n\n## Examples\n\nBelow are examples for translating text, translating documents, and working with glossaries.\n\n### Translate text\n\nTo translate the text \"Hola mundo\" from Spanish (ES) to English (EN):\n\n```sh\ndeepl -i \"Hola mundo\" -t en        # Translation: Hello world\n```\n\nOr, using standard input:\n\n```sh\necho \"Hola mundo\" | deepl -t en    # Translation: Hello world\n```\n\nStandard input translation is useful for quick references.\n\n```sh\ngit --help | deepl -t fr | less\n```\n\nThe `man` command can also be translated (by removing ANSI escape sequences):\n\n```sh\nman git | deepl -t de | less\n```\n\nTo translate multiple lines, press `Ctrl+D` when you have finished typing. This is particularly useful when copying and pasting from the clipboard.\n\n```sh\ndeepl -f es\n# Hola\n# mundo\n# Ctrl + D\n```\n\nTranslate text from the clipboard:\n\n```sh\ndeepl --paste\n```\n\nYou can also pass a text file as an argument:\n\n```sh\ndeepl -t tr foo.txt\n```\n\nIt's possible to pass multiple text files:\n\n```sh\ndeepl -t nl foo.txt bar.txt\n```\n\nIf you are translating multiple files, you might want to add the filename to the header:\n\n```sh\nbat --style header *.txt | deepl -t it\n```\n\nTo use a glossary for translation:\n\n```sh\ndeepl -g myglossary -f ru\n```\n\nTo refer to the original text, you can use `tee dev/stderr`:\n\n```sh\nfortune | tee /dev/stderr | deepl\n```\n\n### Translate Documents\n\nYou can directly translate documents:\n\n```sh\ndeepl doc your.pdf -t pt\n# The translated document will be saved as your_PT.pdf\n```\n\nTo use a glossary for translation:\n\n```sh\ndeepl doc -g myglossary -f pl\n```\n\nTo translate a PDF document and save it in docx format:\n\n```\ndeepl doc input.pdf -O docx -o output.docx\n```\n\nTo translate multiple files, use Unix commands such as `find`, `xargs`, `fd`:\n\n```sh\nfind . -name \"*.pdf\" -exec deepl doc -t ja {} +\n```\n\n```sh\nls -1 *.docx | xargs -L1 deepl doc -t ko\n```\n\n```sh\nfd -e pdf -e docx -x deepl doc -t zh\n```\n\n### Glossaries\n\nThe DeepL API supports glossaries. See [here](https://developers.deepl.com/docs/api-reference/glossaries#formats) for the format of the glossary file.\nThe glossary API is v2. It does not yet support v3.\n\nTo create a glossary:\n\n```sh\ndeepl glossary create -n mydic -f en -t pt mydict.tsv\n```\n\nTo list glossaries:\n\n```sh\ndeepl glossary list\n```\n\nTo list only the names of the glossary:\n\n```sh\ndeepl glossary -l\n```\n\nTo use a glossary for text translation:\n\n```sh\ndeepl -g mydict -f en deep.txt\n```\n\nTo use a glossary for document translation:\n\n```sh\ndeepl doc -g mydict -f en deep.pdf\n```\n\nTo display the contents of the glossary:\n\n```sh\ndeepl glossary view mydict\n```\n\nTo list the languages in which glossaries can be created:\n\n```sh\ndeepl glossary -p\n```\n\n### Rephrase\n\nChange writing style:\n\n```sh\nbin/deepl rephrase -i \"Thanks\" -s academic\n# Expressions of gratitude are extended.\n```\n\nChange tone:\n\n```sh\nbin/deepl rephrase -i \"Thanks\" -t friendly\n# Thank you so much! I really appreciate it.\n```\n\n### Information\n\nTo display a list of available source languages:\n\n```sh\ndeepl -f\n```\n\nTo display a list of available target languages:\n\n```sh\ndeepl -t\n```\n\nTo output usage information:\n\n```sh\ndeepl -u\n\n# https://api.deepl.com/v2\n# character_count: 614842\n# character_limit: 1000000000000\n```\n\n### Environment Variables\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eName\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eDEEPL_AUTH_KEY\u003c/td\u003e\n      \u003ctd\u003eDeepL API authentication key\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eDEEPL_TARGET_LANG\u003c/td\u003e\n      \u003ctd\u003eDefault target language\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eDEEPL_USER_AGENT\u003c/td\u003e\n      \u003ctd\u003eUser-Agent\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eEDITOR\u003c/td\u003e\n      \u003ctd\u003eText editor for editing glossary\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\nDeepL CLI automatically detects the target language, but if this does not work, the environment variable `DEEPL_TARGET_LANG` can be set.\n\n## Contributing\n\n- Fork this repository\n- Report bugs\n- Fix bugs and submit pull requests\n- Write, clarify, or fix documentation\n- Suggest or add new features\n\n## Development\n\nCompilation from source code\n\n```sh\ngit clone https://github.com/kojix2/deepl-cli\ncd deepl-cli\nshards build --release\n```\n\nA compiled binary file will be created in the `bin` directory. Installation is simply copying the generated binary.\n\n```\nsudo cp bin/deepl /usr/local/bin\n```\n\nIf you encounter a bug, follow the command with the `-d` option and run it. You can view the backtrace.\n\n```sh\ndeepl doc -d a.pdf\n```\n\n### DeepL API Library\n\n- [https://github.com/kojix2/deepl.cr/](https://github.com/kojix2/deepl.cr/)\n\n## License\n\nThis project is licensed under the MIT License.\n\nHappy translating!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkojix2%2Fdeepl-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkojix2%2Fdeepl-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkojix2%2Fdeepl-cli/lists"}