Install Google Pinyin in Ubuntu

I had been using Sun Pinyin for a long time, but once I tried Google Pinyin I never looked back. Here is how to get a comfortable Chinese Pinyin setup on Ubuntu.

Note: This post has been updated for Fcitx5, the input method framework that ships with current Ubuntu (20.04 and later). The original 2013 version installed the standalone fcitx-googlepinyin package on Fcitx 4 through the fcitx-team PPA. That package is now unmaintained; Fcitx5’s built-in Pinyin engine, paired with the Cloud Pinyin addon, is its modern replacement, and no PPA is needed.

Installing Fcitx5 and the Chinese Addons

Fcitx5 is the input method framework: it keeps a slim core and gets its actual capabilities from addons. The Pinyin engine, along with Cloud Pinyin, Shuangpin, and the table-based methods, lives in the fcitx5-chinese-addons package, which is where the old fcitx-googlepinyin functionality moved to:

sudo apt update
sudo apt install fcitx5 fcitx5-chinese-addons

The GTK and Qt frontends (fcitx5-frontend-gtk3, fcitx5-frontend-qt5) are usually pulled in as dependencies. Install them explicitly if some applications fail to pick up the input method.

Setting Fcitx5 as the Default Input Method

Ubuntu still ships with iBus as the default, so you need to switch the system input method to Fcitx5:

im-config -n fcitx5

Then log out and back in (or reboot) so that the GTK_IM_MODULE, QT_IM_MODULE, and XMODIFIERS environment variables are set to point at Fcitx5. If you prefer a GUI, you can make the same change from the Language Support dialog.

Adding Pinyin and Enabling Cloud Input

Open Fcitx5 Configuration (the fcitx5-configtool command, or search for it in the app launcher). On the Input Method tab, click the + button and add Pinyin to your list.

To get the cloud candidates that made Google Pinyin feel so good (the equivalent of the old “Cloud” feature), switch to the Addons tab, enable Cloud Pinyin, and pick a provider. Now press Ctrl + Space to toggle the input method and start typing. The best candidates will be suggested from the cloud as you go.

References