How to setup another language for your keyboard on Arch Linux

Photo by Clay Banks on Unsplash

How to setup another language for your keyboard on Arch Linux

Make your keyboard diverse! 🇮🇳 🇯🇵 🇬🇧

·

3 min read

I am trying to learn Japanese so that I can watch those "stupid cartoons" of mine without needing to read those pesky subtitles.

What do you need?

  1. Language Fonts

  2. Input Method (IM) and Input Method Editor (IME)

  3. Input Method Framework (IMF)

How to get them?

Language Fonts

Here are the list of fonts that you can use:

  • adobe-source-han-sans-jp-fonts - Japanese OpenType/CFF fonts, style Gothic (sans-serif).

  • adobe-source-han-serif-jp-fonts - Japanese OpenType/CFF fonts, style Mincho (serif).

  • noto-fonts-cjk - Google Noto CJK fonts.

  • otf-ipafont - Formal style Japanese Gothic (sans-serif) and Mincho (serif) fonts set; one of the highest quality open source font. Default of openSUSE-ja.

  • otf-ipaexfont - An updated version of ipafont.

  • ttf-hanazono - A free Japanese kanji font, style Mincho (serif).

  • ttf-sazanami - Japanese free TrueType font. This is outdated and not maintained any more, but may be defined as a fallback font on several environments.

  • ttf-koruriAUR - Japanese TrueType font obtained by mixing ttf-mplusAUR and Open Sans

  • ttf-monapoAUR - Japanese fonts to show 2channel Shift JIS art properly.

  • ttf-mplus-gitAUR - Modern Gothic style Japanese outline fonts. It includes all of Japanese Hiragana/Katakana, Basic Latin, Latin-1 Supplement, Latin Extended-A, IPA Extensions and most of Japanese Kanji, Greek, Cyrillic, Vietnamese with 7 weights (proportional) or 5 weights (monospace).

  • ttf-vlgothicAUR - Japanese Gothic fonts. Default of Debian/Fedora/Vine Linux

  • ttf-kanjistrokeordersAUR - KanjiStrokeOrders font that indicates the stroke order of characters.

Here I am gonna go with..

sudo pacman -S noto-fonts-cjk noto-fonts-emoji noto-fonts

The Noto Font Family has everything that you will ever need, here we are just installing noto-fonts-cjk for Chinese, Japanese, and Korean fonts, noto-fonts-emoji for emoji fonts and noto-fonts for Latin fonts.

You can check out the entire font family here.

Note: It is not necessary to install noto-fonts and noto-fonts-emoji packages for our diverse keyboard.

Locale

Locales are used to correctly display regional or language/locale-specific standards. To ensure the Japanese locale is enabled, confirm that ja_JP.utf8 is in the output of:

$ locale -a

To enable the Japanese locale, uncomment ja_JP.utf8 in /etc/locale.gen:

/etc/locale.gen
...
#ja_JP.EUC-JP EUC-JP  
ja_JP.UTF-8 UTF-8  
#ka_GE.UTF-8 UTF-8  
...

Afterwards, regenerate your locale:

$ locale-gen

Input Method Framework (IMF)

An Input Method Framework (IMF) is a software framework that facilitates the input of characters not directly supported by a keyboard. This is particularly important for languages with large character sets, such as Chinese, Japanese, and Korean, which often require more than the standard keyboard layout to input characters efficiently.

There are two options of IMF for us: ibus or fcitx5. We are going to go with fcitx5.

sudo pacman -S fcitx5-im

The fcitx5-im installs fcitx, fcitx5-configtool, fcitx5-gtk, and fcitx5-qt. This usually covers everything that you might need.

Once you are done installing you also need to add these environment variables

GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx

Input Method (IM) or Input Method Editor (IME)

The Input Method (IM) and Input Method Editor (IME) refer to the methodology and implementation respectively but nowadays they are used interchangeably. In short, the IM refers to a particular way to use the keyboard to input a particular language, for example, the Cangjie method, the pinyin method, or the use of dead keys. On the other hand, IME refers to the actual program that allows the implementation to be used.

We are going to go with mozc for fcitx which is fcitx5-mozc.

sudo pacman -S fcitx5-mozc

Just A Bit More

We are almost there, open fcitx5-configtool and search for mozc. Once you find it add it as an input method. Press Ctrl + Space — 役に立たないブログでした

References

[1] https://wiki.archlinux.org/title/Input_method

[2] https://en.wikipedia.org/wiki/Input_method

[3] https://developer.mozilla.org/en-US/docs/Glossary/Input_method_editor

[4] https://wiki.archlinux.org/title/Localization/Japanese

[5] https://medium.com/@ourhopeforfreedom/why-i-switched-from-ibus-to-fcitx5-c6950eb3ba9e

Did you find this article valuable?

Support Pratik Thakare by becoming a sponsor. Any amount is appreciated!