trans
Translate text from one language to another
TLDR
Translate a word (language is detected automatically)
Get a brief translation
Translate a word into french
Translate a word from German to English
Behave like a dictionary to get the meaning of a word
SYNOPSIS
trans [OPTIONS] [TEXT...]
trans :<target_lang> [TEXT...]
trans <source_lang>:<target_lang> [TEXT...]
trans -i
PARAMETERS
-b, --brief
Output only the translation, without additional details.
-s <lang>, --source <lang>
Specify the source language for translation.
-t <lang>, --target <lang>
Specify the target language for translation.
-i, --interactive
Enter an interactive translation shell for continuous input.
-l, --list-languages
List all supported language codes.
-V, --version
Print the version information of trans.
--speak
Speak the translated text (requires an external text-to-speech engine).
--detect
Detect and display the language of the provided text.
-e <engine>, --engine <engine>
Specify the translation engine to use (e.g., google, bing, yandex).
--set-proxy <url>
Set a proxy for network requests (e.g., http://host:port).
DESCRIPTION
The trans command, also known as translate-shell, is a powerful command-line utility for translating text.
It provides quick access to various online translation services like Google Translate, Bing Translator, and Yandex.Translate, directly from your terminal.
Users can effortlessly translate words, phrases, or entire sentences without opening a web browser.
Key features include automatic source language detection, translation to multiple target languages, dictionary lookups, and text-to-speech output for translations.
It also offers an interactive shell mode for continuous translation sessions.
trans is highly efficient for developers, writers, or anyone needing instant translation capabilities within their workflow.
CAVEATS
trans relies on unofficial APIs of online translation services, which means its functionality can occasionally break due to changes in those services.
An active internet connection is required for most operations.
Users should be aware of potential rate limiting or temporary IP blocking by translation providers.
Privacy is a consideration, as text is sent to third-party services for processing.
Translation accuracy is dependent on the underlying machine translation engine.
INTERACTIVE SHELL
By invoking trans with the -i or --interactive option, users enter a continuous translation environment.
This mode allows for entering multiple lines of text one after another for translation without re-executing the command each time, making it ideal for extended translation sessions.
LANGUAGE CODES
trans utilizes standard ISO 639-1 two-letter language codes for specifying source and target languages (e.g., 'en' for English, 'fr' for French, 'es' for Spanish).
A comprehensive list of supported languages and their corresponding codes can be retrieved using the -l or --list-languages option.
INSTALLATION
trans can typically be installed on Linux distributions via their package managers (e.g., apt-get install translate-shell on Debian/Ubuntu, dnf install translate-shell on Fedora).
It can also be installed using pip (Python package manager) for users who prefer that method, or by cloning its Git repository and following manual installation instructions.
HISTORY
The trans command, officially known as translate-shell, is an open-source project primarily written in Bash and Awk.
It began as a simple script to leverage Google Translate from the command line and has evolved significantly into a feature-rich, community-driven tool.
Its development has focused on providing a robust and convenient CLI interface for translation, adapting to changes in web services and expanding support for various translation engines and advanced features like text-to-speech and interactive modes.