← 返回命令列表

Linux command

trans 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Translate text

trans "[text]"

Translate to a specific language

trans :[target_lang] "[text]"

Translate from one language to another

trans [source]:[target] "[text]"

Translate to multiple languages

trans :fr+de+es "[text]"

Brief mode

trans -b "[text]"

Listen to the translation

trans -p :[target] "[text]"

Identify the language

trans -id "[text]"

Start interactive mode

trans -shell

说明

Translate Shell (trans) is a command-line translator powered by Google Translate (default), Bing Translator, Yandex.Translate, and Apertium. It provides quick access to translation services from the terminal. Language codes follow ISO 639 standards (e.g., en, fr, de, zh-CN, ja). The source language is auto-detected if not specified. Multiple target languages can be specified by joining codes with +. Interactive mode (-shell) allows translating line by line. Audio playback requires mplayer, mpv, or mpg123. The tool can also function as a dictionary with the -d flag.

参数

-b, -brief
Brief mode; show only the translation.
-d, -dictionary
Show dictionary definition of the word.
-id, -identify
Identify the language of the text.
-p, -play
Listen to translation via text-to-speech.
-speak
Listen to the original text.
-s, -source _lang_
Specify source language.
-t, -target _lang_
Specify target language.
-i, -input _file_
Read text from a file.
-o, -output _file_
Write translation to a file.
-shell, -interactive
Start an interactive translation shell.
-e, -engine _engine_
Use a specific translation engine (google, bing, yandex, apertium).
-T, -reference
Print reference table of all supported languages.
-V, -version
Print version and exit.
-H, -help
Print help message and exit.

FAQ

What is the trans command used for?

Translate Shell (trans) is a command-line translator powered by Google Translate (default), Bing Translator, Yandex.Translate, and Apertium. It provides quick access to translation services from the terminal. Language codes follow ISO 639 standards (e.g., en, fr, de, zh-CN, ja). The source language is auto-detected if not specified. Multiple target languages can be specified by joining codes with +. Interactive mode (-shell) allows translating line by line. Audio playback requires mplayer, mpv, or mpg123. The tool can also function as a dictionary with the -d flag.

How do I run a basic trans example?

Run `trans "[text]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -b, -brief do in trans?

Brief mode; show only the translation.