OmegaT HowTo:
Using Google Translate in OmegaT

Besides the web page into which users can simply paste text for translation, Google Translate also provides an interface (API) which can be used by CAT tools to access the service. As of December 2011, Google has required payment from users for use of this service. This HowTo describes how to configure the function in OmegaT.

1. If you don't already have one, open an account with google.com.

2. Follow this link to apply to Google for the Google Translate API v2 key. Make sure that you have your credit card details handy. Google will generate your API key, a string with approximately 39 characters.

3. Assign the key to OmegaT's launch procedure as follows, depending upon whether you are using Windows, Mac, or launching OmegaT from the command line or by means of a script:

Windows users:

3.1. Locate the configuration file OmegaT.l4J.ini (the default location is C:\Program Files (x86)\OmegaT).

3.2. To edit this file, you may need Administrator mode, or to move it temporarily to a different location on your hard drive.

3.3. Open OmegaT.l4J.ini in a plain-text editor

3.4. Find the following lines;

# Google Translate v2 API key
#-Dgoogle.api.key=xxxxx
And remove "#" at the line head of -Dgoogle.api.key.

# Google Translate v2 API key
-Dgoogle.api.key=xxxxx

(where "xxxxx" is the API key provided by Google).

3.5. Save OmegaT.l4J.ini (and if necessary, move it back to the OmegaT folder).

Mac users:

3.6. Right-click on OmegaT.app and select "Show Package Contents".

3.7. Find the file OmegaT.app/Contents/MacOS/OmegaT.sh and select your preferred editor to open the file.

3.8. Find the following lines;

# Google Translate v2 API key
#GOOGLE_API_KEY="-Dgoogle.api.key=0123456789A0123456789B0123456789C0123456789D"
And remove "#" at the line head. This line defines GOOGLE_API_KEY.

# Google Translate v2 API key
GOOGLE_API_KEY="-Dgoogle.api.key=XXXXXXXX"

where "XXXXXXXX" is your Google Translate API key.

3.9 Save OmegaT.sh.

Linux users:

3.10 Make sure that you have the Kaptain launcher installed (refer if necessary to the Linux Howto), then enter the Google Translate API key in the relevant field on the Connectivity tab.

Users launching OmegaT from the command line or by a script:

3.11 Add the following argument to the launch command:

-Dgoogle.api.key=XXXXXXXX

where "XXXXXXXX" is your Google Translate API key.

The basic launch command with the Google Translate API added will therefore be:

java -jar -Dgoogle.api.key=XXXXXXXX OmegaT.jar

4. Configuration in OmegaT

4.1. Launch OmegaT

4.2. Select Options > Machine Translate

4.3. Check Google Translate v2 (leaving the other options unchecked)

5. Note:

5.1 Google Machine Translation is a paid service (US$20.00 per million characters). You can check the daily usage from your Google account. In the upper menu:

More > Even More > Innovation/Code > APIs Console > Service/Translate API

Copyright Milan Hubacek and Marc Prior 2011