├── Google Translate Selection.workflow
└── Contents
│ ├── Info.plist
│ ├── QuickLook
│ └── Preview.png
│ └── document.wflow
├── Google Translate.workflow
└── Contents
│ ├── Info.plist
│ ├── QuickLook
│ └── Preview.png
│ └── document.wflow
└── README.md
/Google Translate Selection.workflow/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSServices
6 |
7 |
8 | NSMenuItem
9 |
10 | default
11 | Google Translate Selection
12 |
13 | NSMessage
14 | runWorkflowAsService
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Google Translate Selection.workflow/Contents/QuickLook/Preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dbmrq/workflow-translate/6c871c96123c445b58bc76dfb559990e8f6365ca/Google Translate Selection.workflow/Contents/QuickLook/Preview.png
--------------------------------------------------------------------------------
/Google Translate Selection.workflow/Contents/document.wflow:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AMApplicationBuild
6 | 428
7 | AMApplicationVersion
8 | 2.7
9 | AMDocumentVersion
10 | 2
11 | actions
12 |
13 |
14 | action
15 |
16 | AMAccepts
17 |
18 | Container
19 | List
20 | Optional
21 |
22 | Types
23 |
24 | com.apple.applescript.object
25 |
26 |
27 | AMActionVersion
28 | 1.0.2
29 | AMApplication
30 |
31 | Automator
32 |
33 | AMParameterProperties
34 |
35 | source
36 |
37 |
38 | AMProvides
39 |
40 | Container
41 | List
42 | Types
43 |
44 | com.apple.applescript.object
45 |
46 |
47 | ActionBundlePath
48 | /System/Library/Automator/Run AppleScript.action
49 | ActionName
50 | Executar AppleScript
51 | ActionParameters
52 |
53 | source
54 | on run
set savedClipboard to the clipboard
tell application "System Events" to keystroke "c" using {command down}
delay 1
set output to "http://translate.google.com/translate_t?sl=auto&tl=en&text=" & urldecode(the clipboard as string)
set the clipboard to savedClipboard
return output
end run
on urldecode(x)
set cmd to "'require \"cgi\"; puts CGI.escape(STDIN.read.chomp)'"
do shell script "echo " & quoted form of x & " | ruby -e " & cmd
end urldecode
55 |
56 | BundleIdentifier
57 | com.apple.Automator.RunScript
58 | CFBundleVersion
59 | 1.0.2
60 | CanShowSelectedItemsWhenRun
61 |
62 | CanShowWhenRun
63 |
64 | Category
65 |
66 | AMCategoryUtilities
67 |
68 | Class Name
69 | RunScriptAction
70 | InputUUID
71 | 67CC5C6A-C872-4E6A-AA85-093331D24E6E
72 | Keywords
73 |
74 | Executar
75 |
76 | OutputUUID
77 | 26206F0D-BAFC-4DA5-9D72-036030469C6B
78 | UUID
79 | F3C78391-F740-4938-BF22-8D7565B8373C
80 | UnlocalizedApplications
81 |
82 | Automator
83 |
84 | arguments
85 |
86 | 0
87 |
88 | default value
89 | on run {input, parameters}
90 |
91 | (* Your script goes here *)
92 |
93 | return input
94 | end run
95 | name
96 | source
97 | required
98 | 0
99 | type
100 | 0
101 | uuid
102 | 0
103 |
104 |
105 | isViewVisible
106 |
107 | location
108 | 539.000000:316.000000
109 | nibPath
110 | /System/Library/Automator/Run AppleScript.action/Contents/Resources/Base.lproj/main.nib
111 |
112 | isViewVisible
113 |
114 |
115 |
116 | action
117 |
118 | AMAccepts
119 |
120 | Container
121 | List
122 | Optional
123 |
124 | Types
125 |
126 | com.apple.cocoa.url
127 |
128 |
129 | AMActionVersion
130 | 2.0.1
131 | AMApplication
132 |
133 | Safari
134 |
135 | AMParameterProperties
136 |
137 | outputTypeTag
138 |
139 | positionTag
140 |
141 | sizeFormatTag
142 |
143 | targetSizeX
144 |
145 | targetSizeY
146 |
147 | userAgentTag
148 |
149 |
150 | AMProvides
151 |
152 | Container
153 | List
154 | Types
155 |
156 | com.apple.cocoa.string
157 |
158 |
159 | ActionBundlePath
160 | /System/Library/Automator/Website Popup.action
161 | ActionName
162 | Pop-up do Site
163 | ActionParameters
164 |
165 | outputTypeTag
166 | 0
167 | positionTag
168 | 1
169 | sizeFormatTag
170 | 99
171 | targetSizeX
172 | 800
173 | targetSizeY
174 | 600
175 | userAgentTag
176 | 0
177 |
178 | BundleIdentifier
179 | com.apple.Automator.Website_Popup
180 | CFBundleVersion
181 | 2.0.1
182 | CanShowSelectedItemsWhenRun
183 |
184 | CanShowWhenRun
185 |
186 | Category
187 |
188 | AMCategoryInternet
189 |
190 | Class Name
191 | AMWebsitePoppupAction
192 | InputUUID
193 | 2AFBF4D1-F61B-4C9F-B295-AD4D28608DBD
194 | Keywords
195 |
196 | OutputUUID
197 | 8A27E1E5-BFBD-4236-88E1-BBF5C52750BE
198 | UUID
199 | 7E4573D3-3CAE-4FC4-9233-E0E1326EC1D2
200 | UnlocalizedApplications
201 |
202 | Safari
203 |
204 | arguments
205 |
206 | 0
207 |
208 | default value
209 | 0
210 | name
211 | userAgentTag
212 | required
213 | 0
214 | type
215 | 0
216 | uuid
217 | 0
218 |
219 | 1
220 |
221 | default value
222 | 0
223 | name
224 | positionTag
225 | required
226 | 0
227 | type
228 | 0
229 | uuid
230 | 1
231 |
232 | 2
233 |
234 | default value
235 | 0
236 | name
237 | sizeFormatTag
238 | required
239 | 0
240 | type
241 | 0
242 | uuid
243 | 2
244 |
245 | 3
246 |
247 | default value
248 | 0.0
249 | name
250 | targetSizeY
251 | required
252 | 0
253 | type
254 | 0
255 | uuid
256 | 3
257 |
258 | 4
259 |
260 | default value
261 | 0
262 | name
263 | outputTypeTag
264 | required
265 | 0
266 | type
267 | 0
268 | uuid
269 | 4
270 |
271 | 5
272 |
273 | default value
274 | 0.0
275 | name
276 | targetSizeX
277 | required
278 | 0
279 | type
280 | 0
281 | uuid
282 | 5
283 |
284 |
285 | isViewVisible
286 |
287 | location
288 | 539.000000:463.000000
289 | nibPath
290 | /System/Library/Automator/Website Popup.action/Contents/Resources/Base.lproj/main.nib
291 |
292 | isViewVisible
293 |
294 |
295 |
296 | connectors
297 |
298 | 7368C488-AA54-49B0-84EA-127EB7133EC0
299 |
300 | from
301 | F3C78391-F740-4938-BF22-8D7565B8373C - F3C78391-F740-4938-BF22-8D7565B8373C
302 | to
303 | 7E4573D3-3CAE-4FC4-9233-E0E1326EC1D2 - 7E4573D3-3CAE-4FC4-9233-E0E1326EC1D2
304 |
305 |
306 | workflowMetaData
307 |
308 | serviceApplicationBundleID
309 |
310 | serviceApplicationPath
311 |
312 | serviceInputTypeIdentifier
313 | com.apple.Automator.nothing
314 | serviceOutputTypeIdentifier
315 | com.apple.Automator.nothing
316 | serviceProcessesInput
317 | 0
318 | workflowTypeIdentifier
319 | com.apple.Automator.servicesMenu
320 |
321 |
322 |
323 |
--------------------------------------------------------------------------------
/Google Translate.workflow/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSServices
6 |
7 |
8 | NSMenuItem
9 |
10 | default
11 | Google Translate
12 |
13 | NSMessage
14 | runWorkflowAsService
15 | NSSendTypes
16 |
17 | public.utf8-plain-text
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Google Translate.workflow/Contents/QuickLook/Preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dbmrq/workflow-translate/6c871c96123c445b58bc76dfb559990e8f6365ca/Google Translate.workflow/Contents/QuickLook/Preview.png
--------------------------------------------------------------------------------
/Google Translate.workflow/Contents/document.wflow:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AMApplicationBuild
6 | 428
7 | AMApplicationVersion
8 | 2.7
9 | AMDocumentVersion
10 | 2
11 | actions
12 |
13 |
14 | action
15 |
16 | AMAccepts
17 |
18 | Container
19 | List
20 | Optional
21 |
22 | Types
23 |
24 | com.apple.applescript.object
25 |
26 |
27 | AMActionVersion
28 | 1.0.2
29 | AMApplication
30 |
31 | Automator
32 |
33 | AMParameterProperties
34 |
35 | source
36 |
37 |
38 | AMProvides
39 |
40 | Container
41 | List
42 | Types
43 |
44 | com.apple.applescript.object
45 |
46 |
47 | ActionBundlePath
48 | /System/Library/Automator/Run AppleScript.action
49 | ActionName
50 | Executar AppleScript
51 | ActionParameters
52 |
53 | source
54 | on run {input, parameters}
set output to "http://translate.google.com/translate_t?sl=auto&tl=en&text=" & urldecode(input as string)
return output
end run
55 |
on urldecode(x)
set cmd to "'require \"cgi\"; puts CGI.escape(STDIN.read.chomp)'"
do shell script "echo " & quoted form of x & " | ruby -e " & cmd
end urldecode
56 |
57 | BundleIdentifier
58 | com.apple.Automator.RunScript
59 | CFBundleVersion
60 | 1.0.2
61 | CanShowSelectedItemsWhenRun
62 |
63 | CanShowWhenRun
64 |
65 | Category
66 |
67 | AMCategoryUtilities
68 |
69 | Class Name
70 | RunScriptAction
71 | InputUUID
72 | 99246780-49EA-43BE-9BF1-BB2EB840A2C5
73 | Keywords
74 |
75 | Executar
76 |
77 | OutputUUID
78 | 041EA688-5580-44A5-870C-E069349D22DE
79 | UUID
80 | A2A2B13D-7AFA-423A-A7DF-A943E1E3CD46
81 | UnlocalizedApplications
82 |
83 | Automator
84 |
85 | arguments
86 |
87 | 0
88 |
89 | default value
90 | on run {input, parameters}
91 |
92 | (* Your script goes here *)
93 |
94 | return input
95 | end run
96 | name
97 | source
98 | required
99 | 0
100 | type
101 | 0
102 | uuid
103 | 0
104 |
105 |
106 | conversionLabel
107 | 0
108 | isViewVisible
109 |
110 | location
111 | 539.000000:316.000000
112 | nibPath
113 | /System/Library/Automator/Run AppleScript.action/Contents/Resources/Base.lproj/main.nib
114 |
115 | isViewVisible
116 |
117 |
118 |
119 | action
120 |
121 | AMAccepts
122 |
123 | Container
124 | List
125 | Optional
126 |
127 | Types
128 |
129 | com.apple.cocoa.url
130 |
131 |
132 | AMActionVersion
133 | 2.0.1
134 | AMApplication
135 |
136 | Safari
137 |
138 | AMParameterProperties
139 |
140 | outputTypeTag
141 |
142 | positionTag
143 |
144 | sizeFormatTag
145 |
146 | targetSizeX
147 |
148 | targetSizeY
149 |
150 | userAgentTag
151 |
152 |
153 | AMProvides
154 |
155 | Container
156 | List
157 | Types
158 |
159 | com.apple.cocoa.string
160 |
161 |
162 | ActionBundlePath
163 | /System/Library/Automator/Website Popup.action
164 | ActionName
165 | Pop-up do Site
166 | ActionParameters
167 |
168 | outputTypeTag
169 | 0
170 | positionTag
171 | 1
172 | sizeFormatTag
173 | 99
174 | targetSizeX
175 | 800
176 | targetSizeY
177 | 600
178 | userAgentTag
179 | 0
180 |
181 | BundleIdentifier
182 | com.apple.Automator.Website_Popup
183 | CFBundleVersion
184 | 2.0.1
185 | CanShowSelectedItemsWhenRun
186 |
187 | CanShowWhenRun
188 |
189 | Category
190 |
191 | AMCategoryInternet
192 |
193 | Class Name
194 | AMWebsitePoppupAction
195 | InputUUID
196 | 24C82E9E-FCA1-4CB9-A79A-56F75870C013
197 | Keywords
198 |
199 | OutputUUID
200 | 00B12336-8609-4E17-A432-8BA35481DDF4
201 | UUID
202 | 2ABB2ECB-4B7B-4643-892D-E8A62120A819
203 | UnlocalizedApplications
204 |
205 | Safari
206 |
207 | arguments
208 |
209 | 0
210 |
211 | default value
212 | 0
213 | name
214 | userAgentTag
215 | required
216 | 0
217 | type
218 | 0
219 | uuid
220 | 0
221 |
222 | 1
223 |
224 | default value
225 | 0
226 | name
227 | positionTag
228 | required
229 | 0
230 | type
231 | 0
232 | uuid
233 | 1
234 |
235 | 2
236 |
237 | default value
238 | 0
239 | name
240 | sizeFormatTag
241 | required
242 | 0
243 | type
244 | 0
245 | uuid
246 | 2
247 |
248 | 3
249 |
250 | default value
251 | 0.0
252 | name
253 | targetSizeY
254 | required
255 | 0
256 | type
257 | 0
258 | uuid
259 | 3
260 |
261 | 4
262 |
263 | default value
264 | 0
265 | name
266 | outputTypeTag
267 | required
268 | 0
269 | type
270 | 0
271 | uuid
272 | 4
273 |
274 | 5
275 |
276 | default value
277 | 0.0
278 | name
279 | targetSizeX
280 | required
281 | 0
282 | type
283 | 0
284 | uuid
285 | 5
286 |
287 |
288 | conversionLabel
289 | 0
290 | isViewVisible
291 |
292 | location
293 | 539.000000:463.000000
294 | nibPath
295 | /System/Library/Automator/Website Popup.action/Contents/Resources/Base.lproj/main.nib
296 |
297 | isViewVisible
298 |
299 |
300 |
301 | connectors
302 |
303 | F5043961-0FBC-424F-BE07-8C94280E98E3
304 |
305 | from
306 | A2A2B13D-7AFA-423A-A7DF-A943E1E3CD46 - A2A2B13D-7AFA-423A-A7DF-A943E1E3CD46
307 | to
308 | 2ABB2ECB-4B7B-4643-892D-E8A62120A819 - 2ABB2ECB-4B7B-4643-892D-E8A62120A819
309 |
310 |
311 | workflowMetaData
312 |
313 | serviceApplicationBundleID
314 |
315 | serviceApplicationPath
316 |
317 | serviceInputTypeIdentifier
318 | com.apple.Automator.text
319 | serviceOutputTypeIdentifier
320 | com.apple.Automator.nothing
321 | serviceProcessesInput
322 | 0
323 | workflowTypeIdentifier
324 | com.apple.Automator.servicesMenu
325 |
326 |
327 |
328 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # workflow-translate
3 |
4 | A couple of Automator workflows to translate the selected text with Google
5 | Translate.
6 |
7 | The `Google Translate` workflow can receive any text: just right click on the
8 | selected text and chose "Google Translate" from the "Services" contextual
9 | menu.
10 |
11 | A few applications, like macOS's Preview, won't allow to do that, though.
12 | The `Google Translate Selection` workflow works around that by copying the
13 | selected text to the clipboard and translating from there. It has to be called
14 | from the application's menu (instead of the contextual menu).
15 |
16 |
17 | ## Instalation
18 |
19 | Just double click the `.workflow` files. You can add keyboard shortcuts by
20 | going to the keyboard preferences, selecting "Shortcuts" and then "Services".
21 |
22 | ---
23 |
24 | Most of the credits go to this guy: https://medium.com/@mrdoro/fast-translation-with-google-translator-and-mac-osx-817e32233b7a
25 |
26 |
--------------------------------------------------------------------------------