Localization/Japanese

From ArchWiki

This article describes how to set up a Japanese language environment and input method. It only covers the general and recommended cases . For full details on alternatives (e.g. Japanese input on tty or less common input method frameworks), see their respective It does not cover setting up Japanese input on the console/tty.

Fonts

To display Japanese characters, a Japanese (or Chinese) font must be installed. If text appears as gibberish on your screen, ensure you have an appropriate Japanese (Chinese can also suffice) font installed on your system.

Some recommended Japanese fonts are as follows (see Fonts or Font configuration for more fonts or their configuration):

  • 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.

Locale

See locale for details.

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
Note: UTF-8 character sets are generally recommended over others.

Japanese Input

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Reason: While this tries to avoid duplicating too much of the dedicated pages, environment variables from each tool in particular should probably be de-duplicated too. Help:Reading#Organization (Discuss in Talk:Localization/Japanese)

To type Japanese characters using a Western keyboard, an input method (or input method editor (IME)) is required to convert rōmaji into kana or kanji.Wikipedia:Romanization_of_Japanese To conveniently switch between different IMEs (e.g. to switch between English and Japanese input), IMEs often function as part of an Input Method Framework (IMF) to enable easily switching between different keyboard layouts.

Input Method Framework (IMF)

The most common IMFs are IBus (more common for GTK-based environments) and Fcitx5 (more common for Qt-based environments), which support all available Japanese IMEs. For a full overview of IMFs and supported IMEs, see this table. This article only briefly covers installation and configuration of #Fcitx5 and #IBus.

Fcitx5

Note:
  • The Fcitx package has been superseded by Fcitx5 since November 2020, and Fcitx has been put in maintenance mode. Users are recommended to use Fcitx5 instead of Fcitx.
  • fcitx5 only contains the basic framework, while the fcitx5-im group also includes input method modules for GTK and Qt applications, and a configuration tool. This covers most cases.

In most cases, installing the fcitx5-im group suffices. For full details and instructions, see Fcitx5#Installation.

Tip:
  • The fcitx5-im group supports most GTK and Qt applications. If you are noticing issues, you can install fcitx5-qt4-gitAUR, fcitx5-qt6-gitAUR, and/or fcitx5-lua for Qt4, Qt6, and date and time support respectively.
  • Fcitx ships with a limited number of themes, which can be configured using the config tool. For more details on themes and appearance, see Fcitx5#Themes for more themes and information.

To enable Fcitx5, configure at least the following environment variables:

GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
Note: Do not replace fcitx with fcitx5 even if using Fcitx5.

IBus

Install the ibus package. See IBus#Installation for more information.

To enable IBus, configure at least the following environment variables:

GTK_IM_MODULE=ibus
QT_IM_MODULE=ibus
XMODIFIERS=@im=ibus

Input Method Editor (IME)

Both Fcitx5 and IBus support all available Japanese IMEs. Follow the instructions for installing the IME of your choosing. If in doubt, #Mozc is a good recommendation.

Mozc

From the project's home page:

Mozc is a Japanese input method editor (IME) designed for multi-platform such as Android OS, Apple OS X, Chromium OS, GNU/Linux and Microsoft Windows. This OpenSource project originates from Google Japanese Input.

Install the Mozc version for the IMF of your choosing (e.g. fcitx5-mozc for Fcitx5 or ibus-mozcAUR for IBus support}}).

Tip: Mozc can also be enabled in Emacs by installing the emacs-mozcAUR package.

Anthy

Note: Anthy has been effectively dead since 2009.[1]

Anthy is supported or built into most IMFs, though it is effectively dead.

Install the Anthy version for the IMF of your choosing (e.g. fcitx5-anthy for Fcitx5 or ibus-anthy for IBus support).

SKK (libssk)

Simple Kana to Kanji (SKK) is a basic kana to kanji conversion method based on Emacs. It was designed by Dr. Masahiko Sato (Professor Emeritus, Kyoto University) (old link) and created in 1987.[2] A unique feature of SKK is that it converts words one by one (single-word conversion), without analysing syntax or grammar.

Install the libskk version for the IMF of your choosing (e.g. fcitx5-skk for Fcitx5 or ibus-skk for IBus support).

Tip: Installing fcitx5-skk or ibus-skk installs the skk-jisyo dictionary package. The SKK dictionary can be managed with the optional skktools package.

KKC (libkkc)

From the project's GitHub page:

libkkc provides a converter from Kana-string to Kana-Kanji-mixed-string. It was named after kkc.el in GNU Emacs, a simple Kana Kanji converter, while libkkc tries to convert sentences in a bit more complex way using N-gram language models.

Install the libkkc version for the IMF of your choosing (e.g. fcitx5-kkc for Fcitx5 or ibus-kkc for IBus support).

Google CGI API for Japanese Input

Available IM frameworks: uim

Google CGI API for Japanese Input (Google-CGIAPI-Jp) is CGI service to provide Japanese conversion on the Internet by Google. It can be used on web browser. Its conversion engine seems to be equivalent to Google Japanese Input, so conversion quality is probably better than Mozc.

Note: This service sends/receives preedits and candidates as plain text (as of 2012-09).

You can use it via uim. Choose "Google-CGIAPI-Jp" on uim-im-switcher-gtk/gtk3/qt4 or uim-pref-gtk/gtk3/qt4.

See also