Home » Blog » Hacks » OmegaT + Google Translate v2 + Mac OS X

OmegaT + Google Translate v2 + Mac OS X

OmegaT is a free, open-source, cross-platform computer-assisted translation tool. One of its useful features is an interface to the Google Translate API that enables it to provide a (somewhat helpful) machine translation of each chunk of text as it is being translated. Earlier this year, Google announced that its free translation API is to be replaced with a paid service, and will stop altogether on 1st December 2011.

Providing an API key

Recent versions of OmegaT are compatible with the paid service (Google Translate v2), but before you can use it you have to set up an account with Google and give them your credit card details. In return, you’ll get an identification code called an API key that OmegaT will need when interacting with Google. However, the OmegaT developers haven’t yet made it very easy to enter this key.

Windows users can provide this information by adding the following line to the OmegaT.l4J.ini configuration file (replacing “xxxx” with your actual API key):


On other operating systems, the API key has to be provided as a command line argument when the OmegaT Java application is started up. Which is a nuisance, because there’s no way of adding command line arguments when you start an application by clicking its icon.

A workaround for OS X

This can be remedied with a bit of AppleScript and Unix scripting. Copy and paste the following code into AppleScript editor (not forgetting to replace “xxxx” with your API key), then save it as a run-only application. Don’t call this file OmegaT.app; any other name is fine.

set apikey to "xxxx" as string
set ss to "java -jar -Dgoogle.api.key=" & apikey & " $(ls -ptd $(find " & ¬
     "/Applications -name \"OmegaT.app\" -maxdepth 2 -type d |xargs) " & ¬
     "|head -1)Contents/Resources/Java/OmegaT.jar >/dev/null 2>&1 &" as string
do shell script ss

You can then drag this file to the dock and run it with a single mouse click. It works by searching for a file called OmegaT.app inside your Applications folder, digging down to the Java application inside it, and then launching this application with your API key as a command line argument. If you have more than one version of OmegaT installed on your computer, this script will run the most recent one it can find.

★ Update ★

Jean-Christophe from the OmegaT team just informed me that there’s another way of providing a Google Translate API key, which involves adding a google.api.key item under Java > Properties in the info.plist file inside the OmegaT application bundle. This is definitely a neater solution, but will have to be repeated every time you upgrade OmegaT, unfortunately.

Here’s a screen capture to show you how it’s done. The green blobs are left-clicks, and the expanding circles are right-clicks.

Thanks, Jean-Christophe.

How to add your Google API key to info.plist in OmegaT

This entry was posted in Hacks, Translation and tagged . Bookmark the permalink.

One Response to OmegaT + Google Translate v2 + Mac OS X

  1. timmy says:


    Jean-Christophe’s method works like magic. Did not try the original one, but I am very happy it works now. Makes life much easier.

More posts

Previous post:

Next post:

Header image: Maple leaves and bamboo stems in autumn at Tenryū-ji garden (天龍寺庭園) in Kyoto. Photo: Frank Gualtieri.

Powered by WordPress