Skip to content

Instantly share code, notes, and snippets.

@Swisyn
Forked from buddax2/GoogleTranslate.workflow
Created December 6, 2018 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Swisyn/433616355989287a3fc0b5ed6109fd6c to your computer and use it in GitHub Desktop.
Save Swisyn/433616355989287a3fc0b5ed6109fd6c to your computer and use it in GitHub Desktop.
Google Translate Automator Service
on run {input, parameters}
set output to "http://translate.google.com/translate_t?sl=auto&tl=uk&text=" & urldecode(input as string)
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment