9

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?

3 Answers 3

28

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 (please don't think "this isn't necessary", just do it or you will waste more precious time!)
  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.

13
  • I see there is zh in the upper right in Ubuntu. But I input with that it is English too.
    – Y. zeng
    Commented May 20, 2022 at 9:19
  • @Y.zeng are you sure you chose "Chinese (Intelligent pinyin)"? You should get a "拼" rather than "zh" Commented May 21, 2022 at 5:08
  • It shows "zh". Then I uninstall it and reinstall it. It shows "拼“
    – Y. zeng
    Commented May 21, 2022 at 5:15
  • @Y.zeng and do you now get Chinese characters? Commented May 21, 2022 at 8:52
  • 2
    Yes. I feel the Ubuntu 22.04 is not enough stable.
    – Y. zeng
    Commented May 21, 2022 at 12:02
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.

3
  • 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! Commented Jan 24, 2023 at 7: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
    Commented Jan 27, 2023 at 2:37
  • 1
    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
    Commented Feb 24, 2023 at 9:41
-1

For Chinese user, I followed Sogou official install guide on linux in here and try to install it on my Ubuntu 22.04 LTS. And I still can NOT use it. After did some search, and I did 2 things as follow below, then it works.

One: delete ibus config and cache

cd ~/.config 
ll | grep ibus
rm -rf ibus*

cd ~/.cache 
ll | grep ibus
rm -rf ibus*

Two: For Wayland, add some env variables in /etc/environment

# file: "/etc/environment"
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS="@im=fcitx"

Lastly, you need reboot.

Usage: ctrl + space to shift [sogou input method] and [system english]

PS: I also wrote a Chinese blog for help and submit a feedback to [sogou team]. PS again: I read a Chinese blog says disable Wayland, I don't know. It seems very aggressive move. For Wayland, maybe add some env variables are cooler.

1
  • Yet again... This is another set of half instructions for previous versions of Ubuntu. The original post was intended to NOT have 56 different ways of doing this for different versions. Commented Aug 30 at 11:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .