Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyboard Shortcut - Launch Google Translate for Selected Text
#1
Often at my work, I need to translate documents received from international customers when English is not used. Typically, after selecting the text (from anywhere), you have to copy it (to the clipboard), start your browser, go to Google Translate, paste it (from the clipboard) in the query field, and then click a button to translate. This whole process can be very long and repetitive.

To solve this, I developed a quick AutoHotkey script to process the translation into Google Translate. I select the non-English text, then I activate the shortcut from Shortkeeper. Immediately after, Google Translate opens up in my internet browser and instantly shows me the English version of the text. Here's the AutoHotkey script to be used in Shortkeeper:

ClipSaved := ClipboardAll
Clipboard =
SendInput, ^c
ClipWait, 2
if ErrorLevel
{
  run % "https://translate.google.ca/#view=home&op=translate&sl=en&tl=fr"
}
else
{
  SelectedText := Trim(Clipboard)
  SelectedText := StrReplace(SelectedText, """", "%22")
  run % "https://translate.google.ca/#view=home&op=translate&sl=en&tl=fr&text=" . SelectedText
}
Clipboard := ClipSaved

Note that you can change the input and output language, to whatever language Google Translate supports, by changing the ''en'' and ''fr'' in the URL address to your preferred language code. In this example, I translate from English to French.

This shortcut is by far a game changer and ultimately saves me lots of precious time at work. Hope you enjoy it as much as I do!
Reply
#2
Thanks for sharing. The script works very well.

This short tutorial "https://cedeq.com/forums/showthread.php?tid=29" will help someone needing help to create a keyboard shortcut with ShortKeeper using AutoHotkey code.
Enterpad: For those who need more than a few shortcuts.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)