How to create a macro which uses google translate with pdf documents, and functions just like the google translate chrome extension

My question pertains specifically to translating highlighted text, not the whole page.
The Chrome Google translate extension is fantastic. Highlighted text is immediately displayed in a google translate window on the same web page (not in a separate tab)
I would like to create a macro which would have the same functionality, but with pdf documents. I know that you can input whole pdf documents into the google translate web site, but:

  • the quality of the output is not good because of formatting problems.
  • I specifically want to get immediate translations of highlighted text in a window displayed on the pdf document, not in a browser tab for example (which would be easy to do)
    thanks very much for your time and help

I don't have a pure KM solution for you, maybe my workflow with the App Mya Translate will help you.

With my KM macro I can translate directly in all apps (mail, PDF, Safari etc.) and for the price of 2,29 € you can't do much wrong.

Translate.kmmacros (4,4 KB)

1 Like

If you are using PopClip @ronald, I can recommend the App Myna for Google Translate. Although it costs 4,49 €, PopClip makes it easier to use.

Herzlichen Dank for your answer and for writing the macro
I purchased Miya from the app store and tested your macro: it works fine.

  • it is funny that the author does not provide any kind of user manual and even seems to have deleted Miya from his list of products, for reasons I do not understand.
  • one very small glitch with your macro, it the fact that one repetitive sentence is inserted at the beginning of each text: Default Clipboard Text. Reading your macro, I do not know where it comes from.

thank you again

Please forgive my mistake. Change the KM settings - Clipboards Translate to _Translate and add it to the macro (arrow).

1 Like

Thank you for your reply. There still seems to be a problem.

Can you please send me a screenshot of your clipboards in KM @ronald The error doesn't occur with me like this.

1 Like

vielen Dank

Hey @ronald,

Your “Translate” clipboard is still named “Translate”, without the underscore. To make the macro work properly, you need to either add an underscore to the clipboard’s name and make it “_Translate”, or change %NamedClipboard%_Translate% in your current macro to %NamedClipboard%Translate%.

1 Like

Hi Ronald,

you might be interested in my macro for Translate Shell. It displays the result in a KM window.

It has the further advantage that you can also choose the DeepL engine, which in many cases deliveres better translations than Google.

1 Like

thank you. It works fine after making the correction.
I will look into your macro