1TW(1) User Commands TW(1)
2
3
4
6 tw - translate words into different languages
7
9 tw [OPTIONS] [DICTIONARY] [TERM]
10
11 Example: tw en-es hello
12
14 translate word is a command that translates words into different lan‐
15 guages. translate word uses internal dictionaries, and contacts online
16 to the Google Translation and the FreeTranslation engines.
17
18 Mandatory arguments for long options are mandatory for short options
19 too.
20
21 -l, --list
22 list available dictionaries
23
24 -s, --shortcuts
25 list available dictionaries shortcuts
26
27 -x, --exact
28 try to perform an exact match
29
30 -y, --synonyms
31 try to perform a synonym triangulation
32
33 -p, --spelling
34 try to check the spelling grammar
35
36 -k, --speak
37 try to speak the text
38
39 -d, --disable-logging
40 disable logging of failure terms
41
42 -h, --help
43 show a help message
44
45 -v, --version
46 show the program version
47
48 Create ~/.tw directory to enable caching and logging (mkdir ~/.tw).
49
50 With no term, or when term is -, read standard input.
51
52 For straight synonyms, check mythes command.
53
55 Translate an english word to spanish using local dictionary
56 $ tw en-es hello
57 hola
58
59 Search your dictionaries
60 $ tw -l | grep en-es
61 share.en-es
62 cache.en-es
63 local.en-es
64 www.freetranslation.com.en-es
65 translate.google.com.en-es
66
67 List your shortcuts
68 $ tw -s
69 share = sh
70 cache = ca
71 local = lo
72 www.freetranslation.com = ft
73 translate.google.com = gt
74
75 Translate an english word to spanish using Google Translator
76 $ tw translate.google.com.en-es Hello
77 Hola
78 $ tw gt.en-es Hello
79 Hola
80
81 Language Helper (uses dict)
82 $ function lh { dict -d wn "$1"; echo; echo "Translation: $(tw en-es "$1")" }
83 $ lh mink
84 1 definition found
85
86 From WordNet (r) 3.0 (2006) [wn]:
87
88 mink
89 n 1: the expensive fur of a mink
90 2: fur coat made from the soft lustrous fur of minks [syn:
91 {mink}, {mink coat}]
92 3: slender-bodied semiaquatic mammal having partially webbed
93 feet; valued for its fur
94
95 Translation: visón
96
97 Select text in an xsession, and translate it with "control + t" (uses
98 xbindkeys + xsel + xmessage/xdialog/gdialog/zenity/kdialog/...)
99 ~/.xbindkeysrc
100 "term=$(xsel); [[ ! -z $term ]] && (translation=$(tw -d en-es "$term") || translation=$(tw gt.en-es "$term"); [[ -z $translation ]] && translation="Translation not found."; kdialog --title "Translate Word" --msgbox "$translation")"
101 control + t
102 "term=$(kdialog --title "Translate Word" --inputbox "Term:"); [[ ! -z $term ]] && (translation=$(tw -d en-es "$term") || translation=$(tw gt.en-es "$term"); [[ -z $translation ]] && translation="Translation not found."; kdialog --title "Translate Word" --msgbox "$translation")"
103 control + shift + t
104 $ xbindkeys
105
106 Local (offline) translation (so limited that it performs a non exact
107 match search)
108 $ tw en-es fur
109 piel
110 fake fur : piel sintética
111 furuncle : furúnculo
112
113 Get offline cached online translation
114 $ mkdir ~/.tw
115 $ tw gt.en-es fur
116 piel
117 $ tw --list
118 ***
119 ***
120 cache.en-es
121 $ tw cache.en-es fur
122 piel
123 $ tw en-es fur
124 piel
125
126 Pronunciation Helper (uses festival)
127 $ function ph { tw en-es "$1"; echo "$1" | festival --tts; }
128 $ ph mink
129 visón
130 ***
131
132 Don't use a lot of online resources
133 $ function twc { tw -d en-es "$1" 2> /dev/null || tw gt.en-es "$1"; }
134
135 Pipe in
136 $ echo "hello" | tw en-es -
137 hola
138
139 Exact match
140 $ tw en-es hi
141 hola
142 ***hi :
143 *hi** :
144 **hi* :
145 hi*** :
146 $ tw -x en-es hi
147 hola
148
149 Synonyms
150 $ tw en-es awesome
151 tw: term not found (maybe not connected) logged /home/$user/.tw/en-es.twdf
152 Try `tw --help' for more information.
153 $ tw -y en-es awesome
154 asombroso
155 impresionante
156 $ mythes en awesome
157 amazing
158 awe-inspiring
159 awful
160 awing
161 impressive
162 $ mythes es impresionante
163 alucinante
164 asombroso
165 aterrador
166 catastrófico
167 dantesco
168 emocionante
169 escalofriante
170 espantoso
171 espeluznante
172 estremecedor
173 horrible
174 horripilante
175 increíble
176 infernal
177 inquietante
178 pasmoso
179 pavoroso
180 sensacional
181 sobrecogedor
182 sorprendente
183 terrible
184 tremendo
185
186 Speak
187 $ tw -x -k en-es home
188 hogar
189 ((( home ))) (voice: en)
190 ((( hogar ))) (voice: es)
191
193 To add dictionaries just place them in ${pre‐
194 fix}/share/tw/lang1-lang2.twd ( tw dictionary , format is term1 :
195 translation2 ). To add new engines just implement ${pre‐
196 fix}/share/tw/tw_*.sh (see actual implementations for examples). In
197 both cases, integration is automated.
198
199 Caches are located in ~/.tw/*.twdc ( tw dictionary cache ), and handled
200 transparently. Logs of untranslated terms are located in ~/.tw/*.twdf
201 ( tw dictionary failure ), specially you could check this files when
202 going online.
203
204 If you use the online engines respect their terms of use. Consider con‐
205 tributing local dictionaries or improvements to this project.
206
208 Written by Juan Manuel Borges Caño.
209
211 tw (translate word) home page <http://code.google.com/p/translateword>.
212
214 Report bugs to <juanmabcmail@gmail.com>.
215
217 Copyright © 2007-2020 Juan Manuel Borges Caño
218 This is free software. You may redistribute copies of it under the
219 terms of the GNU General Public License
220 <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the
221 extent permitted by law.
222
224 The full documentation for tw is maintained as a Texinfo manual. If
225 the info and tw programs are properly installed at your site, the com‐
226 mand
227
228 info tw
229
230 should give you access to the complete manual.
231
232
233
234tw 0.9.16 July 2020 TW(1)