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