Set up Fcitx for Chinese and Japanese language input on Ubuntu Trusty 14.04

fcitx.pngAfter recently upgrading to Ubuntu 14.04 Trusty Tahr (LTS), I decided to give Fcitx, the default input method framework on Ubuntu’s Chinese sister project Ubuntu Kylin, a try and I was pleasantly surprised. Not only is Fcitx rock-solid and actively developed, it also offers input methods for Japanese, Korean, Vietnamese and a bunch of other languages in addition to the default Chinese input methods. Here is how you get it to work on Ubuntu 14.04.

  1. Make sure you remove any IBus input methods you may have been using previously: Go to System Settings -> Text Entry, and remove all entries in the pane below “Input sources to use”, except the one representing your default keyboard layout.
    Also make sure to remove the keyboard shortcuts for “Switch to next source” and “Switch to previous source” by clicking inside the corresponding boxes on the right and hitting Backspace.
  2. Install the following packages via Software Center, Synaptic or sudo apt-get install:
    fcitx fcitx-pinyin fcitx-sunpinyin fcitx-googlepinyin fcitx-anthy fcitx-mozc
  3. Use a terminal (Ctrl + Alt + T) or a Run dialogue (Alt + F2) to run: im-config
    When asked if you want to explicitly update the user preferences, select “Yes”, then select fcitx as the default input method framework in the dialogue which pops up.
  4. Log off and back on again, or better yet, reboot.
  5. You should now see a keyboard icon in your system tray in the upper right corner of your screen. Click the icon and choose “Configure Current Input Method”, which should the Input Method Configuration. Clicking the plus “+” sign in the lower left corner of that window will open a small dialogue window. Uncheck the box “Only Show Current Language” and add the input methods you need (more on that below).
  6. Close the settings window, open your favourite text editor, bring up your desired input method via the Fcitx tray icon -> Input Method or the keyboard trigger shortcut: Ctrl + Space. You can also use Ctrl + Shift to move to the next input method.

There are a wide variety of options to configure the default behaviour of Fcitx and its looks. I like to preserve the input method state across windows, for example, which can be set under: Fcitx tray icon -> Configure Current Input Method -> Global Config.

Recommended Input Methods

sunpinyin.pngAs for input methods, I recommend Sun Pinyin for Chinese, and Mozc (which originates from Google Japanese Input) for Japanese. Both are excellent input methods that work very reliably in everyday use and are at least on par with what you get on Windows or Mac. Unfortunately the version of Sun Pinyin found in the Ubuntu 14.04 repositories suffers from a bug that prevents you from entering “yue” or “qiong”. To get around this, you have to update the package for “sunpinyin-data”, either by compiling it yourself or by getting a more recent version from the Debian repos. If you opt for the latter, run the following in your terminal:

wget http://http.us.debian.org/debian/pool/main/o/open-gram/sunpinyin-data_0.1.22+20131212-1_amd64.deb

Then compare the various checksums against the numbers you find on https://packages.debian.org/jessie/amd64/sunpinyin-data/download:

md5sum sunpinyin-data_0.1.22+20131212-1_amd64.deb
openssl sha1 sunpinyin-data_0.1.22+20131212-1_amd64.deb
sha256sum sunpinyin-data_0.1.22+20131212-1_amd64.deb

If they match, go ahead and install the package via: sudo dpkg -i sunpinyin-data_0.1.22+20131212-1_amd64.deb

Links

19 comments to Set up Fcitx for Chinese and Japanese language input on Ubuntu Trusty 14.04

  • Marc Tremblay

    Good morning,

    I work for a school board in Montreal and we have been converting out older labs and laptops over to Lubuntu and LXLE. We teach two languages, English and French so we need to be able to switch from and english keyboard to the canadian multilingual for French. It was suggested that we install FCITX to be able to do this. Would you be able to tell us how to add the Canadian Multilingual keyboard and then switch between the two keyboard layouts??

    Any help would be greatly appreciated

    • stefan.a

      It may be possible to do this using Fcitx, although I haven’t tried myself. My suggestion would be to look for the keyboard layout you need in the list of input methods that comes up when you open the dialogue window in step 4 above. The primary purpose of frameworks like Fcitx is to give you a way to enter more complex languages, however. So in principle you shouldn’t really need to install Fcitx to simply switch between different keyboard layouts. Have a look at the following pages:

      http://noobish-nix.blogspot.com/2012/06/how-to-add-and-switch-keyboard-layout.html
      http://wiki.lxde.org/en/Change_keyboard_layouts#Hotkey_solution_using_setxkbmap
      https://help.ubuntu.com/community/Lubuntu/Keyboard#Multiple_keyboard_layouts

      Hope this helps!

    • nnlajfd

      If it’s just english and french use iBus instead, only drawback of iBus is shitty chinese support

      • stefan.a

        You probably don’t even need an input method for that, since I believe you can switch keyboard layouts independently, at least on Ubuntu. iBus was okay for a time, but its long-standing bugs kept bothering me, so I made the switch to fcitx a while ago, which was a big improvement in terms of usability and stability. As far as I can tell most East Asian Linux distros now use fcitx by default, too.

        • Brian.Ng

          Your link to that bug is not iBus problem. It’s a unimplemented feature which is not currently supported by oracle-java or open-java. The last time I tried Chinese input in java-based program, the input windows was not following the caret, and it was always on the left corner, and that’s just so bad!

          • stefan.a

            Hi Brian! Thanks for clearing this up. I didn’t realise that this was a Java issue, so my bad! I certainly didn’t mean to belittle the iBus developers’ efforts. I simply started having issues with Java input after switching from SCIM to iBus, although I haven’t used SCIM long enough to say anything about its reliability. I have been using fcitx for about a year and a half now and found it more reliable than either iBus or SCIM, though

  • Walberto Ibarra

    Great info, thanks!

    I just want to point out a typo on your last command, it should be:
    sudo dpkg -i sunpinyin-data_0.1.22+20131212-1_amd64.deb

  • luke

    Thank you very much, this works perfectly!

  • joshua

    Sorry, I’m new to linux and using ubuntu14.04 LTS, after step 4 as outlined above, there were no options for chinese despite completing step 5. Any help would be greatly appreciated.

  • joshua

    This is what I got when i tried to nstall the package via: sudo dpkg -i sunpinyin-data_0.1.22+20131212-1_amd64.deb:

    yoda@yoda-gb238aa-ab4-a6098d:~$ sudo dpkg -i sunpinyin-data_0.1.22+20131212-1_amd64.deb
    dpkg: error processing archive sunpinyin-data_0.1.22+20131212-1_amd64.deb (–install):
    package architecture (amd64) does not match system (i386)
    Errors were encountered while processing:
    sunpinyin-data_0.1.22+20131212-1_amd64.deb

  • Percy

    Thanks for the nice blog, it worked for me and solved my problems and save me a lot time.

  • Zig

    A million thanks! This is the first website offering instructions that worked for me.

  • Swarup

    I have been using Fcitx for Hindi and Bengali language input in Ubuntu for around two years now, and it is really nice. I am now setting up the very same thing for a friend on his computer, but cannot remember one key step in what I did two years ago! Hoping you can help. The matter relates with your step #5:

    “You should now see a keyboard icon in your system tray in the upper right corner of your screen. Click the icon and choose “Configure Current Input Method”, which should the Input Method Configuration. Clicking the plus “+” sign in the lower left corner of that window will open a small dialogue window. Uncheck the box “Only Show Current Language” and add the input methods you need (more on that below).”

    Here the key is that the input methods I need are not listed in that list, and I need to add them in the list somehow so I can select them. The two input methods I need to add are:

    bn-baraha.mim
    hi-baraha.mim

    These are two input methods in m17n. I have these two files on my computer, and need to get them added into the list of input methods available for selection in the window. Thank you!

    • stefan.a

      Thanks for your comment, Swarup. Unfortunately, I am not sure how to do this manually. Have you checked if there are packages available in the official Ubuntu/Debian repositories to install support for those languages you require? Installing language support manually may be possible, but that is something I am not familiar with myself. Sorry!

  • Swarup

    There are definitely packages in the official Ubuntu/Debian repositories to install support for Hindi and Bengali and I already have installed those packages. But these languages have various input method engines, and the ones I need (the two listed above) are not in the official packages. I have already manually installed these two IME’s for use with Fcitx in one computer two years ago. Indeed it is the computer which I still use every day. But I cannot remember how I did it! Do you have the contact information for anyone in the Fcitx development group? I’m sure any of them could refresh my memory with a quick note. But I haven’t been able to find their contact information.

  • kris C

    Thanks very much for all your precious advices !!! It was really bad for me with ibus …
    Now it’s working perfectly!!!

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>