Sunday, February 6, 2011

Set Default Traditional Chinese in IBUS under English Ubuntu 10.10

I am using Ubuntu 10.10 in my netbook. Basically, this is good and I used it for a long time. However, I hate the Ibus default setting for my usual chinese input method (cangjie) as the default chinese mode is simplied chinese if I use English Ubuntu (locale: LANG: en_HK). Thus, I found a way to solve my problem and set the default chinese mode to be traditional. I modified the ibus problem.

1. Edit /usr/share/ibus-table/engine/table.py
2. Find the following code (at about line 116)
if __lc.find('zh_') == 0:
                # this is a zh_XX
                __place =__lc.split('_')[1]
                if __place == 'cn':
                    return 0
                else:
                    return 1
            else:
                if self.db._is_chinese:                                                                               
                    # if IME declare as Chinese IME
                    return 0
                else:
                    return -1
3. Edit as following
if __lc.find('zh_') == 0:
                # this is a zh_XX
                __place =__lc.split('_')[1]
                if __place == 'cn':
                    return 0
                else:
                    return 1
            else:
                if self.db._is_chinese:                                                                               
                    # if IME declare as Chinese IME
                    # return 0
                    return 1  #Edit this line to return 1 instead of 0
                else:
                    return -1
4. Restart IBUS and DONE

3 comments:

  1. Thank you very much! This worked perfectly!

    ReplyDelete
  2. The change still work on my Ubuntu 12.04, Thanks.

    ReplyDelete
  3. This change doesn't work for Ubuntu 12.10. Is it because my keyboard input method is ibus?


    ReplyDelete