{"id":19750900,"url":"https://github.com/sheepla/strans","last_synced_at":"2025-04-30T10:31:08.073Z","repository":{"id":65149589,"uuid":"583310306","full_name":"sheepla/strans","owner":"sheepla","description":"📖 A command line translate tool with interactive mode inspired by translate-shell","archived":false,"fork":false,"pushed_at":"2023-08-05T13:17:17.000Z","size":67,"stargazers_count":33,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T00:51:10.451Z","etag":null,"topics":["cli","go-cli","lingva","lingva-translate","repl","translate","translate-cli","translate-shell"],"latest_commit_sha":null,"homepage":"","language":"Go","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/sheepla.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":"2022-12-29T11:52:22.000Z","updated_at":"2025-01-27T09:35:30.000Z","dependencies_parsed_at":"2024-06-19T11:28:53.086Z","dependency_job_id":"67992fea-9708-4ece-97a1-e5b50b635bd5","html_url":"https://github.com/sheepla/strans","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Fstrans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Fstrans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Fstrans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Fstrans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sheepla","download_url":"https://codeload.github.com/sheepla/strans/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251684510,"owners_count":21627143,"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":["cli","go-cli","lingva","lingva-translate","repl","translate","translate-cli","translate-shell"],"created_at":"2024-11-12T02:40:33.204Z","updated_at":"2025-04-30T10:31:07.810Z","avatar_url":"https://github.com/sheepla.png","language":"Go","readme":"\u003cdiv align=\"right\"\u003e\n\n[![golangci-lint](https://github.com/sheepla/strans/actions/workflows/ci.yml/badge.svg)](https://github.com/sheepla/strans/actions/workflows/ci.yml)\n[![Release](https://github.com/sheepla/strans/actions/workflows/release.yml/badge.svg)](https://github.com/sheepla/strans/actions/workflows/release.yml)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n# strans\n\n\u003c/div\u003e\n\n\n\u003cdiv align=\"center\"\u003e\n\nA command line translate tool written in Go with GNU Readline-like interactive mode (`--repl`) inspired by [translate-shell](https://github.com/soimort/translate-shell)\n\n\n![Language:Go](https://img.shields.io/static/v1?label=Language\u0026message=Go\u0026color=blue\u0026style=flat-square)\n![License:MIT](https://img.shields.io/static/v1?label=License\u0026message=MIT\u0026color=blue\u0026style=flat-square)\n[![Latest Release](https://img.shields.io/github/v/release/sheepla/strans?style=flat-square)](https://github.com/sheepla/strans/releases/latest)\n\n\u003c/div\u003e\n\n## Features\n\n- **Non-interactive mode**: A mode that can be used in the same way as a general command line tool\n- **Interactive mode**: [GNU Readline](https://en.wikipedia.org/wiki/GNU_Readline)-like line editing mode for instant translation\n- **Read translated text aloud**: The option to read the translated text aloud after performing the translation\n\n## Usage\n\n### Specifying languages for translations source and targets\n\nTo specify the translation source/target language, specify values for the arguments of the `-s`, `--source` and `-t`, `--target` options, or set values in the environment variable `STRANS_SOURCE_LANG`, `STRANS_TARGET_LANG`.\n\nIf you specify `?` as the `--source` or `--target` option's value, a fzf-like menu will be displayed, allowing you to interactively select the language.\n\nTo check the list of languages, run the command with `-S`, `--list-source` or `-T`, `--list-target` options.\n\n### Non-interactive mode\n\nIf you specify text as a non-option argument, that text will be translated. Multiple arguments are allowed, and arguments are joined by spaces.\n\n```\nstrans [OPTIONS] TEXT...\n\n# e.g.\nstrans -s en -t ja \"Hello, World\" # =\u003e \"こんにちは世界\"\n```\n\nA non-option argument of `-` will read text from standard input and translate it.\nYou can also output the translated text as speech.\n\n```\nstrans [OPTIONS] -\n\n# e.g.\necho \"Hello, World\" | strans -s en -t ja - # =\u003e \"こんにちは世界\"\nstrans -s en -t ja \u003c README.md # =\u003e The contents of the README.md will translated.\n```\n\n### Interactive mode\n\nTo use interactive mode, run the command with the `-r`, `--repl` flag. \nEnter your text and it will be translated instantly.\n\nYou can use GNU Readline-like line editing, scroll back (`Ctrl-N`, `Ctrl-P`) and incremental search (`Ctrl-R`) the execution history.\n\nEmpty inputs (just typing `Enter`) are ignored and no translation is performed.\n\nTyping `Ctrl-D` exits interactive mode and returns you to the shell you were running from.\n\nThe history is kept in the file `strans_history.txt` in the OS temporary directory \nand can be recalled when executing the command again.\n\n```\n[you@your-computer]$ strans --repl -s ja -t en\n\n[ja -\u003e en]\n\u003e こんにちは世界\nhello world\n\n[ja -\u003e en]\n\u003e bye\n\n[you@your-computer]$ \n```\n\n### Read text as speech (beta)\n\nRunning the command with the `--audio` flag, after executing the translation, read the translated text aloud and you can check the pronunciation.\n\nThis feature is available in both interactive and non-interactive mode.\n\n### Options\n\nSpecify the source language name (e.g. `en`, `ja`, etc.) for `--source` option, and specify the target language name for `--target` option.\n\nTo change the instance, specify the hostname of the instance in the `--instance` option.\n\n```\nNAME:\n   strans - a command line translate tool with GNU Readline like interactive mode\n\nUSAGE:\n   strans [OPTIONS] TEXT...\n   echo TEXT... | strans [OPTIONS] -\n   strans [OPTIONS] - \u003c FILE\n\nVERSION:\n   unknown-unknown\n\nCOMMANDS:\n   help, h  Shows a list of commands or help for one command\n\nGLOBAL OPTIONS:\n   --source value, -s value, --from value  Source language to translate; specifying the value '?' will shows a selectable menu [$STRANS_SOURCE_LANG]\n   --target value, -t value, --to value    Target language to translate; specifying the value '?' will shows a selectable menu [$STRANS_TARGET_LANG]\n   --instance value, -i value              Instance host name of Lingva Translate [$STRANS_INSTANCE]\n   --repl, -r                              Start interactive mode (default: false)\n   --audio, -a                             Read translated text aloud (default: false)\n   --list-source, -S                       Show a list of source languages (default: false)\n   --list-target, -T                       Show a list of target languages (default: false)\n   --help, -h                              show help (default: false)\n   --version, -v                           print the version (default: false)\n```\n\nVarious options can specify default values not only from command line arguments, \nbut also by setting environment variables.\n\n```sh\nSTRANS_TARGET_LANG=\"ja\" strans \"Hello, World\" # =\u003e \"こんにちは世界\"\n\nexport STRANS_SOURCE_LANG=\"en\"\nexport STRANS_TARGET_LANG=\"ja\"\nstrans \"Hello, World\" # =\u003e こんにちは世界\n```\n\nThis tool is a program that calls Lingva Translate's public API. \nSee the Lingva Translate [README.md](https://github.com/thedaviddelta/lingva-translate/blob/main/README.md) for details.\n\n## Installation\n\n```sh\ngo install github.com/sheepla/strans@latest\n```\n\n## Roadmap\n\n- [ ] Distribute pre-built binaries on GitHub release page\n- [ ] Print more translate info (definitions, similar words, examples, pronunciation, etc.)\n\n## Thanks\n\n- [lingva-translate](https://github.com/thedaviddelta/lingva-translate)\n- [translate-shell](https://github.com/soimort/translate-shell)\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheepla%2Fstrans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheepla%2Fstrans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheepla%2Fstrans/lists"}