6

There are well over a decade's worth of mutually incompatible instructions for setting up basic pinyin input on previous versions of Ubuntu. People make lots of claims about needing to do now obsolete rubbish, which means that many people (including me) end up spending many hours only to end up with a broken install.

Is there a simple procedure to set up Chinese pinyin input for simplified characters that doesn't require many hours of trial and error and leave the system half broken?

2 Answers2

19

Note: These instructions are ONLY meant for vanilla Ubuntu and ONLY for 22.04 for basic pinyin input for simplified characters.

Ubuntu has never provided an easy, well-documented option for adding pinyin input support. However, to get basic pinyin support in 22.04 you can simply:

  1. Open Settings, go to Region & Language -> Manage Installed Languages -> Install / Remove languages.
  2. Select Chinese (Simplified). Make sure Keyboard Input method system has Ibus selected. Apply.
  3. Reboot
  4. Log back in, reopen Settings, go to Keyboard.
  5. Click on the "+" sign under Input sources.
  6. Select Chinese (China) and then Chinese (Intelligent Pinyin).

You should now have a little "en" (or whatever the language code of your Ubuntu install is) at the top right of your main screen which you can click on and get a list of available input methods, including Chinese (Intelligent pinyin). Open anything that can receive text (like gedit, openoffice, vim, FF,...) and try it out. You can also change between them with Super/Win + space.

  1. Reboot to make sure it is still there after a reboot.
  2. Be happy that you didn't lose any more time on this ridiculously trivial issue that is still a massive pain in 2022!

If you don't need extra bells and whistles then do NOT bother with fcitx (and the supposedly excellent "google pinyin"), uim or any other exotic option! They are extremely hit-and-miss trying to install, and finding a guide that is relevant to 22.04 is almost impossible. Some claim to have "tested with 22.04" but they have done upgrades of previous versions that they had working, not fresh installs.

4

The default Chinese Pinyin IME installed in Ubuntu desktop settings -> keyboard -> input source is Intelligent Pinyin for IBus (ibus-libpinyin). It works, but not very well, especially when mixing Chinese and English input. After suffering with it for several months, I switched to Fcitx5 and feel much better.

Below is my steps. I already have IBus Pinyin IME working, you may need extra steps from Ubuntu new installation.

  1. Install fctix5

    Run sudo apt install fcitx5 fcitx5-chinese-addons fcitx5-frontend-gtk3

  2. Open Settings -> Keyboard -> Input Source, remove Chinese Pinyin from the list.

    Fcitx IMEs aren't shown in this list. The Gnome desktop IME related settings (e.g. hotkeys) won't affect Fcitx, you need to go to Fcitx Configuration to configure them (see below).

  3. Run im-config, follow the wizard and choose fcitx5 as IME.

  4. Run sudo vi /etc/environment and add below environment variables:

    GTK_IM_MODULE=fcitx
    QT_IM_MODULE=fcitx
    XMODIFIERS=@im=fcitx
    SDL_IM_MODULE=fcitx
    GLFW_IM_MODULE=ibus
    

    This step is important, without it you will be unable to switch IME in most of the applications.

  5. Open Tweaks (install by sudo apt install gnome-tweaks) and add Fcitx 5 to Startup Applications.

  6. Reboot

  7. After system boot, you should be able to see a keyboard icon at the system status bar, which is the Fcitx application. Click on it and choose "Configure" to add IME, change hotkey, etc.

aleung
  • 141
  • can you please confirm that you are using vanilla 22.04? I really don't want this to turn into the same kind of exchange with 50 different incompatible versions! – AntonOfTheWoods Jan 24 '23 at 07:46
  • 1
    @AntonOfTheWoods Yes, I installed Ubuntu 22.04 Desktop which was downloaded from official site. Of course I keep the system upgrading to latest and I've installed several apps before doing this, but none of them is IME related. – aleung Jan 27 '23 at 02:37
  • Followed your steps and successfully install Fcitx5 on Ubuntu 22.04. Thanks! For me my next step is to find out how to add traditional Chinese in Fcitx (couldn't find Jyutping etc). – Wen Ping Feb 24 '23 at 09:41