November 11, 2014

How to Hack Google Translate API

By admin-emal-155 Views-No Comment

Using Google Translate to process long texts without buying an API access key

Do you translate long texts with many random strings, e.g., for software interfaces and websites? Want to pre-process parts of it, so you can just proofread it (“machine translation post-editing”) instead of typing it all?

Some computer-assisted translation (CAT) tools let you use Google’s Translate API.The service is not free. But you can hack it. First I’ll explain the theory, then a specific example.

Principle:

  • Put the source text in a format where the segments are separated by paragraphs; the easiest way is to show it in a table.
  • Copy the source text column, machine-translate it online and place source & target side by side in a table.
  • Put source & target in a translation memory (TM) file to feed it to the CAT program of your choice.

Example: Google Translate and Wordfast Pro.

  1. Upload your sourcefile to Wordfast Anywhere (www.freetm.com); you might need to register (free).

1-1

  1. Export the file as a bilingual table: File > Bilingual File Tools > Offline Review Tool > Export

1-2

You get a DOC file containing a bilingual table.

1-3

  1. Insert the source column as raw text into Google Translator Toolkit. It is machine-translated (MT) right away.

1-4

  1. Open the file created by Google TT and copy the MT output.

1-5

  1. Create a new WordfastTranslation Memory (TM). It is stored in TXT format. You can open it in Excel and view it as a spreadsheet.

– Copy & Paste the source column below the existing entries.

– Do the same with the target column.

– Propagate the info fields (Columns A, B, C, D & F)

– Save the TM in its original format

1-6

  1. Open Wordfast, load the modified TM. Now you should see MT suggestions for each new segment and you just have to post-edit. This can save you a lot of typing when translating computer strings.

1-7

Comments? Please post below!

UPDATE: This post has spawned a debate among experts which you can follow here. There are many good ways to do this.

Leave a Comment