2014년 3월 30일 일요일

Enabling ibus support in OmegaT

In my translation work, I use OmegaT as my CAT tool. Up until 2009, I used Trados on a Windows system, but I finally got fed up with the bugginess and resource-hogging of Trados and switched to OmegaT 2.xx series later that year.

Although OmegaT is rock-solid, it does require some manual setup from the user, especially on Linux. As a translation environment, OmegaT must play nice with various IME's (input method editors) for inputting multiple languages on Linux. Today ibus seems to be the most popular IME on Linux, although many users needing to input East Asian languages still use scim.

Here's my setup for making OmegaT work with ibus-hangul, as I work with both Korean and English on Linux.

1. Add the following entries to your ~/.bashrc file:

export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
export CLUTTER_IM_MODULE=ibus

2. Make sure that the ibus daemon loads at system startup (the specifics depend on what Desktop Environment you are using) with the following flags (in the case of Openbox, I have added the following entry to ~/.config/openbox/autostart):

env IBUS_ENABLE_SYNC_MODE=0 ibus-daemon -rdx

Where:
the -x --xim flag launches the ibus XIM server
the -d flag tells ibus to daemonize or run as a background process
the -r flag tells ibus to replace any old ibus daemons which are currently running
the prefix IBUS_ENABLE_SYNC_MODE=0 is necessary if you want ibus to work with non-GTK / non-QT apps such as Java or EFL (Enlightenment). If this option is not set, the SPACE character will not be correctly inserted for Hangul and other Asian languages. (ex: '가나다 ' will print as '가나 다' with space inserted to the left of the final character)

You can also reload ibus manually by typing the above from the command prompt.

3. In your OmegaT startup script, make sure to invoke OmegaT.jar with the following prefix:

XMODIFIERS=@im=ibus ... /path/to/OmegaT.jar

Here's a sample startup script that launches OmegaT with built-in support for Google Translate API v2 and Microsoft Translate API (the API keys are dummies in this example, of course) where OmegaT.jar has been installed to the folder ~/OmegaT_3.0.8:

#!/bin/bash
XMODIFIERS=@im=ibus java -jar -Xmx512M -Dgoogle.api.key=123456789-aBCde_fgHIjk-l-mnopqrs_tuvw_1 -Dmicrosoft.api.client_id=omegat_KE -Dmicrosoft.api.client_secret=1234567890AbCDEFghijkLMnopqrstuVWXYZ1122334= ~/OmegaT_3.0.8/OmegaT.jar