1TRANS(1) TRANS(1)
2
3
4
6 trans - Command-line translator using Google Translate, Bing Transla‐
7 tor, Yandex.Translate, etc.
8
10 trans [OPTIONS] [SOURCE]:[TARGETS] [TEXT]...
11
13 This tool translates text into any language from the command-line, us‐
14 ing a translation engine such as Google Translate, Bing Translator and
15 Yandex.Translate.
16
17 Each argument which is not a valid option is treated as TEXT to be
18 translated.
19
20 If neither TEXT nor the input file is specified by command-line argu‐
21 ments, the program will read and translate from standard input.
22
24 Information options
25 -V, -version
26 Print version and exit.
27
28 -H, -help
29 Print help message and exit. -M, -man Show man page and exit.
30
31 -T, -reference
32 Print reference table of all supported languages and codes, and
33 exit. Names of languages are displayed in their endonyms (lan‐
34 guage name in the language itself).
35
36 -R, -reference-english
37 Print reference table of all supported languages and codes, and
38 exit. Names of languages are displayed in English.
39
40 -L CODES, -list CODES
41 Print details of languages and exit. When specifying two or
42 more language codes, concatenate them by plus sign "+".
43
44 -S, -list-engines
45 List available translation engines and exit.
46
47 -U, -upgrade
48 Check for upgrade of this program.
49
50 Translator options
51 -e ENGINE, -engine ENGINE
52 Specify the translation engine to use. (default: google)
53
54 Display options
55 -verbose
56 Verbose mode.
57
58 Show the original text and its most relevant translation, then
59 its phonetic notation (if any), then its alternative transla‐
60 tions (if any) or its definition in the dictionary (if it is a
61 word).
62
63 This option is unnecessary in most cases since verbose mode is
64 enabled by default.
65
66 -b, -brief
67 Brief mode.
68
69 Show the most relevant translation or its phonetic notation on‐
70 ly.
71
72 -d, -dictionary
73 Dictionary mode.
74
75 Show the definition of the original word in the dictionary.
76
77 -identify
78 Language identification.
79
80 Show the identified language of the original text.
81
82 -show-original Y/n
83 Show original text or not. (default: yes)
84
85 -show-original-phonetics Y/n
86 Show phonetic notation of original text or not. (default: yes)
87
88 -show-translation Y/n
89 Show translation or not. (default: yes)
90
91 -show-translation-phonetics Y/n
92 Show phonetic notation of translation or not. (default: yes)
93
94 -show-prompt-message Y/n
95 Show prompt message or not. (default: yes)
96
97 -show-languages Y/n
98 Show source and target languages or not. (default: yes)
99
100 -show-original-dictionary y/N
101 Show dictionary entry of original text or not. (default: no)
102
103 This option is enabled in dictionary mode.
104
105 -show-dictionary Y/n
106 Show dictionary entry of translation or not. (default: yes)
107
108 -show-alternatives Y/n
109 Show alternative translations or not. (default: yes)
110
111 -w NUM, -width NUM
112 Specify the screen width for padding.
113
114 This option overrides the setting of environment variable $COL‐
115 UMNS.
116
117 -indent NUM
118 Specify the size of indent (number of spaces). (default: 4)
119
120 -theme FILENAME
121 Specify the theme to use. (default: default)
122
123 -no-theme
124 Do not use any other theme than default.
125
126 -no-ansi
127 Do not use ANSI escape codes.
128
129 -no-autocorrect
130 Do not autocorrect. (if defaulted by the translation engine)
131
132 -no-bidi
133 Do not convert bidirectional texts.
134
135 -bidi Always convert bidirectional texts.
136
137 -no-warn
138 Do not write warning messages to stderr.
139
140 -dump Print raw API response instead.
141
142 Audio options
143 -p, -play
144 Listen to the translation.
145
146 You must have at least one of the supported audio players
147 (mplayer, mpv or mpg123) installed to stream from Google
148 Text-to-Speech engine. Otherwise, a local speech synthesizer
149 may be used instead (say on macOS, espeak on Linux or other
150 platforms).
151
152 -speak Listen to the original text.
153
154 -n VOICE, -narrator VOICE
155 Specify the narrator, and listen to the translation.
156
157 Common values for this option are male and female.
158
159 -player PROGRAM
160 Specify the audio player to use, and listen to the translation.
161
162 Option -play will try to use mplayer, mpv or mpg123 by default,
163 since these players are known to work for streaming URLs. Not
164 all command-line audio players can work this way. Use this op‐
165 tion only when you have your own preference.
166
167 This option overrides the setting of environment variable $PLAY‐
168 ER.
169
170 -no-play
171 Do not listen to the translation.
172
173 -no-translate
174 Do not translate anything when using -speak.
175
176 -download-audio
177 Download the audio to the current directory.
178
179 -download-audio-as FILENAME
180 Download the audio to the specified file.
181
182 Terminal paging and browsing options
183 -v, -view
184 View the translation in a terminal pager (less, more or most).
185
186 -pager PROGRAM
187 Specify the terminal pager to use, and view the translation.
188
189 This option overrides the setting of environment variable
190 $PAGER.
191
192 -no-view, -no-pager
193 Do not view the translation in a terminal pager.
194
195 -browser PROGRAM
196 Specify the web browser to use.
197
198 This option overrides the setting of environment variable
199 $BROWSER.
200
201 -no-browser
202 Do not open the web browser.
203
204 Networking options
205 -x HOST:PORT, -proxy HOST:PORT
206 Use HTTP proxy on given port.
207
208 This option overrides the setting of environment variables
209 $HTTP_PROXY and $http_proxy.
210
211 -u STRING, -user-agent STRING
212 Specify the User-Agent to identify as.
213
214 This option overrides the setting of environment variables $US‐
215 ER_AGENT.
216
217 -4, -ipv4, -inet4-only
218 Connect only to IPv4 addresses.
219
220 -6, -ipv6, -inet6-only
221 Connect only to IPv6 addresses.
222
223 Interactive shell options
224 -I, -interactive, -shell
225 Start an interactive shell, invoking rlwrap whenever possible
226 (unless -no-rlwrap is specified).
227
228 -E, -emacs
229 Start the GNU Emacs front-end for an interactive shell.
230
231 This option does not need to, and cannot be used along with -I
232 or -no-rlwrap.
233
234 -no-rlwrap
235 Do not invoke rlwrap when starting an interactive shell.
236
237 This option is useful when your terminal type is not supported
238 by rlwrap (e.g. emacs).
239
240 I/O options
241 -i FILENAME, -input FILENAME
242 Specify the input file.
243
244 Source text to be translated will be read from the input file,
245 instead of standard input.
246
247 -o FILENAME, -output FILENAME
248 Specify the output file.
249
250 Translations will be written to the output file, instead of
251 standard output.
252
253 Language preference options
254 -l CODE, -hl CODE, -lang CODE
255 Specify your home language (the language you would like to see
256 for displaying prompt messages in the translation).
257
258 This option affects only the display in verbose mode (anything
259 other than source language and target language will be displayed
260 in your home language). This option has no effect in brief
261 mode.
262
263 This option is optional. When its setting is omitted, English
264 will be used.
265
266 This option overrides the setting of environment variables
267 $LC_ALL, $LANG, and $HOME_LANG.
268
269 -s CODES, -sl CODES, -source CODES, -from CODES
270 Specify the source language(s) (the language(s) of original
271 text). When specifying two or more language codes, concatenate
272 them by plus sign "+".
273
274 This option is optional. When its setting is omitted, the lan‐
275 guage of original text will be identified automatically (with a
276 possibility of misidentification).
277
278 This option overrides the setting of environment variable
279 $SOURCE_LANG.
280
281 -t CODES, -tl CODES, -target CODES, -to CODES
282 Specify the target language(s) (the language(s) of translated
283 text). When specifying two or more language codes, concatenate
284 them by plus sign "+".
285
286 This option is optional. When its setting is omitted, every‐
287 thing will be translated into English.
288
289 This option overrides the setting of environment variables
290 $LC_ALL, $LANG, and $TARGET_LANG.
291
292 [SOURCE]:[TARGETS]
293 A simpler, alternative way to specify the source language and
294 target language(s) is to use a shortcut formatted string:
295
296 · SOURCE-CODE:TARGET-CODE
297
298 · SOURCE-CODE:TARGET-CODE1+TARGET-CODE2+...
299
300 · SOURCE-CODE=TARGET-CODE
301
302 · SOURCE-CODE=TARGET-CODE1+TARGET-CODE2+...
303
304 Delimiter ":" and "=" can be used interchangeably.
305
306 Either SOURCE or TARGETS may be omitted, but the delimiter char‐
307 acter must be kept.
308
309 Text preprocessing options
310 -j, -join-sentence
311 Treat all arguments as one single sentence.
312
313 Other options
314 -no-init
315 Do not load any initialization script.
316
317 -- End-of-options.
318
319 All arguments after this option are treated as TEXT to be trans‐
320 lated.
321
323 0 Successful translation.
324
325 1 Error.
326
328 PAGER Equivalent to option setting -pager.
329
330 BROWSER
331 Equivalent to option setting -browser.
332
333 PLAYER Equivalent to option setting -player.
334
335 HTTP_PROXY
336 Equivalent to option setting -proxy.
337
338 USER_AGENT
339 Equivalent to option setting -user-agent.
340
341 HOME_LANG
342 Equivalent to option setting -lang.
343
344 SOURCE_LANG
345 Equivalent to option setting -source.
346
347 TARGET_LANG
348 Equivalent to option setting -target.
349
351 /etc/translate-shell
352 Initialization script. (system-wide)
353
354 $HOME/.translate-shell/init.trans
355 Initialization script. (user-specific)
356
357 $XDG_CONFIG_HOME/translate-shell/init.trans
358 Initialization script. (user-specific)
359
360 ./.trans
361 Initialization script. (current directory)
362
364 <https://github.com/soimort/translate-shell/wiki>
365
367 <https://github.com/soimort/translate-shell/issues>
368
370 Mort Yao <soi@mort.ninja>.
371
372
373
3740.9.6.10 2019-04-20 TRANS(1)