spolyglotSH is a full-featured command-line translator written in Bash. It uses the Google Translate web endpoint to translate text or files directly from the terminal. Designed for CLI workflows, it supports multiple input sources, automatic language detection, and provides safeguards for file size, binary content, and network errors. Ideal for quick translations, scripting, and pipelines.
- Translate text directly from a string, a file, or piped input.
- Automatic source language detection with override option.
- Supports over 100 languages using standard language codes.
- Validates input files to prevent processing of binary files.
- Enforces a maximum file size of 4MB to avoid performance issues.
- Handles network errors, invalid API responses, and parsing errors gracefully.
- Lists all supported languages with their codes.
- Outputs clean translation suitable for piping or saving to a file.
- download repository:
git clone https://github.com/BuriXon-code/polyglotSH && cd polyglotSH- add permissions:
chmod +x translator-q: Translate a text string provided directly.-f: Translate content from a text file. Binary files are rejected. Maximum allowed size: 4MB.-t: Target language (required). Use standard language codes (e.g.,en,pl,fr).-s: Source language (default:auto).-l: List all supported languages.-h: Display help information and usage instructions.
- Translate a string provided directly through a flag:
translator -t en -q "Testuję translator."- Translate the content of a text file.
translator -t en -f /path/to/file- Translate text piped from another command or input source.
some-command | translator -t de- List all supported languages.
translator -l- Bash 4+
curlfor HTTP requestsjqfor JSON parsing- Internet connection to access Google Translate
- Works on Linux, macOS, and WSL/Unix-like systems.
- Supports UTF-8 encoded text files only.
- Input files must not exceed 4MB.
- Rejects binary files to prevent corruption.
- Outputs translation cleanly to stdout, safe for piping and redirection.
Available versions of the program:
- [GO] - polyglot - program written in GO, high compatibility, control, excellent error handling;
- [BASH] - polyglotSH - Bash script, high compatibility, easy installation;
- [PHP] - polyglotPHP - PHP CLI script, high speed, versatility;
- [Python] - polyglotPY - Python script, high compatibility, stability.
OSL-3.0 — see the LICENSE file in the repository.
For any issues, suggestions, or questions, reach out via:
- Email: support@burixon.dev
- Contact form: Click here
- Bug reports: Click here
If you find this script useful, consider supporting my work by making a donation:
Your contributions help in developing new projects and improving existing tools!
