SDB:Write and Read in Japanese using an occidental system

Jump to: navigation, search


This article explains how to setup an occidental system to be able to write and read in the Japanese language.
For the time being, explanations are given only for the GNOME desktop environment. If you try to apply it while using KDE, you may be facing some light troubles.

Tested on openSUSE

Recommended articles

Icon-manual.png

Related articles

Icon-help.png



Situation

Your system is using a language other than an Asian one. You want to be able to write in Japanese or to lend you computer to a calling Japanese friend.


Procedure

The procedure is rather simple but nevertheless not quite obvious. Hereafter are the main stages.

  • Stage 1: Install Japanese fonts
  • Stage 2: Install an IME — Input Method Editor, here ibus — and an Input Method
  • Stage 3: Add an Input Method
  • Stage 4 (only for very special cases): Change the layout of the keyboard associated with the Input Source

Stage 1: Install Japanese Fonts

Become super user:

user $ su

Mot de passe :

Install e.g. Mincho fonts:

root # zypper in jpa-mincho-fonts

Of course you are free to install the fonts you prefer. Here is a short list of available fonts:

* ipa-mincho-fonts
* ipa-gothic-fonts
* ipa-pmincho-fonts
* ipa-ex-mincho-fonts
To discover the available fonts on you system, please make a search with:
root # zypper se fonts

Stage 2: install an IME — Input Method Editor — and an input method for the Japanese language.

For the IME — the tool that allows the user to switch between various input methods and to set them up — there are several solutions. Among them we prefer ibus.

ibus stands for Intelligent Input Bus. It has replaced scim from which it derives.

For the input method — a.k.a. Input Engine, term that corresponds better to the reality —, there are also several possibility including anthy and mozc;

For those who are not familiar with the notion on input engine, let's give a very short introduction.

When one edit a text in English, there is a direct correspondence between the touch that one hits and what is included into the text — generally a letter or a digit. The character is the text atom. In Japanese, the text atom is either a kana, either a katakana or a kanji. Kana(s) and katakana(s) are simple glyphs that match a syllabus e.g. na is written in kana and in katakana. One has to hit two touches on his keyboard in order to enter a kana or a katakana. Kanji(s) are Chinese characters; e. g.  — that means, depending on the context, moon or month—, is written hitting either tsuki, either gatsu or getsu. Moreover, to make things more complicated, there are also a plethora of homonyms among kanji(s). Let's take an example: 簡単 (kantan, easy) and 漢字 (kanji, Chinese character). The first kanji(s) are both pronounced kan but are very different. The input engine is the tool that interprets what the user enters and, taking the context into account, proposes the user an ordered list of possible candidates. It is the the relevancy of the list and of its ranking that reflects the performance of the input engine. In any case, the user has to make the final choice among the candidates.

To be practical, you can install the IME and the input method with a single command:

root # zypper in ibus-mozc

or if you prefer anthy:

root # zypper in ibus-anthy

Both commands will trigger the installation of ibus as a dependency.

To ensure that ibus will be launched at each session start, add the following lines in your .bashrc file:

* export GTK_IM_MODULE=ibus
* export QT_IM_MODULE=ibus
* export XMODIFIERS=@im=ibus
* ibus-daemon -drx
Icon-warning.png
Warning: To go on you must restart the session.

Stage 3: Add an Input Source

An input source is either a keyboard (case of occidental languages) or a keyboard associated with an input method (case of Japanese language for example).
Icon-warning.png
Warning: Normally, it should be possible to add and set up an input method (associated with a keyboard) with the ibus-setup tool. Nevertheless, as it seems that there are some little inconveniences, we are going to implement things differently.
  • Click on the small arrow that point downside in the top right corner of the screen to open the All Settings window.
  • Select Keyboard.
  • At the bottom of the new keyboard window, click on Input Sources.
  • Click on the + sign in the bottom left corner.
  • In the input list, select Japanese.

Pour Mozc

Normally, you should see input method named Japanese (Mozc - < layout name>).

  • Select the one that match your keyboard (as it is the default keyboard, there is no need of a layout name, thus it is: Japanese (Mozc) and click on the Add button.
  • If you want, you can change the keyboard shortcut that allows to pass from one input source to the other by clicking the Options button. Default values are Super+Space in one way, and Super+Maj+Space in the other way.

If everything went well, an input source selector should appear beside the sound icon in the top right corner on the screen. You can use it to select the current input source or you can use the keyboard shortcut you have previously set.

Special case : Change the keyboard layout associated with the input source

It may happen the you want to write in Japanese with an other keyboard than the one you use for your own language and that this keyboard is not listed in the list of Japanese (Mozc - <layout name>) input methods. In such a case, please edit the /usr/share/ibus/component/mozc.xml file. Here is the relevant excerpt that is of interest to us:

<engine>
  <symbol>あ</symbol>
  <description>Mozc (Japanese Input Method)</description>
  <language>ja</language>
  <icon>/usr/share/ibus-mozc/product_icon.png</icon>
  <setup>/usr/lib64/mozc/mozc_tool --mode=config_dialog</setup>
  <layout>default</layout>
  <name>mozc-jp</name>
  <rank>80</rank>
  <longname>Mozc</longname>
</engine>

You need to change the content of the layout xml element by changing the word default with the name of the layout you have opted for.

Icon-warning.png
Warning: The layout name must be in the xx form as e.g. us or fr or in the xx(<variant> form). In the last case, <variant> should exist in the symbol tables associated with xx in the /usr/share/X11/xkb/symbols folder.

Of course, with this modification, it is still Japanese (Mozc) which must be chosen as input method.}}

For Anthy

Normally, you should see an input source named:Japanese (Anthy)'.

  • Select it and click on the Add button.
  • If you want, you can change the keyboard shortcut that allows to pass from one input source to the other by clicking the Options button. Default values are Super+Space in one way, and Super+Maj+Space in the other way.
Icon-warning.png
Warning: To go on you may need to restart the session.

If everything went well, an input source selector should appear beside the sound icon in the top right corner on the screen. Click it to select the Japanese (Anthy) input method. Once selected, click again on the selector icon and in the menu, select Anthy Settings, then select the Input Method tab. In the layout drop-down list, select Default.

See also

This tutorial doesn't explain how to use and setup an input engine. Please check the literature on this subject. You may find the basic elements on this page of the Ubuntu wiki (in French but with self speaking pictures). .


External links