Uim
I download these packages:
$ doas pkg_add ubuntu-fonts uim uim-chewing uim-gtk \
uim-gtk3 zh-fonts-arphicttf zh-fonts-kc zh-libchewing \
zh-libpinyin zh-wqy-bitmapfont zh-wqy-zenhei-ttf
This includes the font packs and UIM input engine for zhuyin (chewing) and pinyin.
Inside ~/.profile, I put this line:
export LC_CTYPE=en_US.UTF-8
You will also want to run that command in your current terminal.
When you need to type Chinese in firefox, I run:
$ uim-toolbar-gtk3
When I need to type Chinese in Xterm, I type:
$ uim-fep -u chewing
To toggle between Chinese and English, type ctrl+space.
For xterm, I add the following lines:
XTerm*forcePackedFont: true
XTerm*cjkWidth: false
XTerm*mkWidth: true
xterm*faceName: DejaVu Sans Mono
xterm*faceSize: 25
Change xterm*faceSize: 25 to match your desired font size. Open a new xterm window to see the new settings.