In this tutorial, we will be discussing how to setup Japanese language environment in Arch Linux. In other Unix-like operating systems, it is not a big deal to setup Japanese layout. You can easily choose the Japanese keyboard layout from Settings. However, it is bit difficult under Arch Linux and there is no proper documentation in ArchWiki. If you're using Arch Linux and/or its derivatives like Antergos, Manajaro Linux, follow this guide to use Japanese language in your Arch Linux and its derivatives systems.
Setup Japanese Language Environment In Arch Linux
First, install the necessary Japanese fonts for viewing Japanese ascii arts properly:
$ sudo pacman -S adobe-source-han-sans-jp-fonts otf-ipafont
$ yay -S ttf-monapo
If you don't have Yay installed already, refer this link.
Make sure you have commented out (add # to comment out) the following line in /etc/locale.gen file.
Then, install iBus and ibus-anthy. For those wondering, iBus is Input method (IM) framework for Unix-like systems and ibus-anthy is the Japanese input method for iBus.
$ sudo pacman -S ibus ibus-anthy
Add the following lines in ~/.xprofile (If it doesn't exist, create one):
# Settings for Japanese input export GTK_IM_MODULE='ibus' export QT_IM_MODULE='ibus' export XMODIFIERS=@im='ibus' #Toolbar for anthy ibus-daemon -drx
The ~/.xprofile file allows us to execute commands at the beginning of the X user session before the window manager is started.
Save and close the file. Restart your Arch Linux system to take effect the changes.
After logging in to your system, right click on the iBus icon in the task bar and choose Preferences. If it is not there, run the following command from Terminal to start IBus and open the preferences window.
Choose Yes to start iBus. You will see a screen something like below. Click Ok to close it.
Now, you will see the iBus preferences window. Go to Input Method tab and click "Add" button.
Choose "Japanese" from the list:
And then, choose "Anthy" and click Add.
That's it. You will now see "Japanese - Anthy" in your Input Method section.
Then change the options for Japanese input as per your requirement in the Preferences section (Click Japanese - Anthy -> Preferences).
You can also edit the default shortcuts in the key bindings section. Once you made all changes, click Apply and OK. That's it. Choose the Japanese language from iBus icon in the task bar or press SUPER KEY+SPACE BAR to switch between Japanese and English languages (or any other default language in your system). You can change the keyboard shortcuts from IBus Preferences window.