I have installed mozc (a Japanese input method editor (IME)) on Ubuntu 14.10. It is working fine. I am able to write in Japanese by going to the icon in the upper-right-hand corner of my screen (what do you call this?) and selecting Hiragana or Katakana from the "Input mode" menu, as in the picture below:
However, this is a very slow process. I imagine there has to be a faster way to switch input modes - a keyboard shortcut or something (like on Windows with Google Japanese Input [to which mozc is related], Alt+` switches between Hiragana and Direct Input). What shortcuts are there for switching input modes, and can they be configured?
TLDR
Abstract
Steps to create the Japanese Mozc key bindings, to switch the input modes:
Gnome Status
menu (Gnome's top-left bar) >IBus
menu (i.e. keyboard/input language selector) > SelectJapanese Mozc
input method.Gnome Status Menu
>IBuz
>tools
>Properties
>Mozc Settings
window.Keymap style
section > click oncustomize
button (first one).ibus-daemon -drx
to reload and take configurations into effect if necessary.reset to defaults
button fromMozc Settings
window.That's all!
Graphical abstract
Steps to create the key bindings to toggle Japanese syllabaries input mode.
Introduction:
The problem: how to type Japanese using a non-Japanese keyboard?
In Japanese (日本語, nihongo), you need to write using a lot of different symbols-sets. A informal categorization of these sets can be like:
alphabetssyllabaries (ひらがな hiragana, かたかな katakana, 漢字 kanji, ローマ字 romaji),So, dedicated keys exists on Japanese keyboards to toggle between them. An analogy with occidental keyboard are the Capslock key to upper/lower-case or, Shift key to insert symbols. But the occidental keyboard hasn't these Japanese keys. So how to type in Japanese using a non-Japanese keyboard?
Solutions
Basically, two solutions can be listed:
Solution 1: Install a Japanese keyboard
Easiest solution so far. Acquire one Japanese keyboard, install and configure on your Operation System. But you need access to one, maybe buying one (with international credit card, taxes, waiting for shipping and so on).
Solution 2: Binding Japanese keys in your non-Japanese keyboard.
It is a cheap solution and you can use it in any keyboard you have. But you need to install software, configure, and memorize MANY key combinations. It is basically "a sea of shortcuts" to emulate the Japanese keyboard. Linux have some software to simulate a Japanese keyboard for using a non-Japanese keyboard.
Let's implement the solution 2.
Theoretical background
Linux input software layers
Our computer can receive inputs from many talked/typed languages and hardware (i.e. different keyboards and layouts). So it needs to organize the configurations and permit to the user choice between different languages. For example, a user can type one document in Italian AND English languages, at alternating times. So the software needs to show the user a way to change the language to be inputted.
The Linux user have 2 layers of software to configure the input method by keyboard:
For the Linux user, an example o IMF is IBus; an a example of IME is MOZC. The first one will switch between all installed IMEs and switch between all idioms/languages installed too. The second one, if selected, will send to the IMF only Japanese keys, even if you typed in a non-Japanese keyboard. About Japanese IMEs, you can read more about here, and visualize the states/events in these diagrams:
Diagram 1:
Diagram 2:
Japanese keyboard
Layout
The Japanese keyboard layout (キーボード) is established by Japanese International Standard (JIS). First of all, let's contemplate the Japanese keyboard! Watch an open box video. You can see the vector draw bellow, showing clearly the Japanese keys:
Finally, some real pictures bellow:
Try to identify each key, slowly.
We have:
You can have more description of these specific keys here. And read about the text frequency of hiragana, katakana e kanji and here.
Typing
How a Japanese user type on this keyboard?
For example, lets type "kakikukeko" in
romaji mode
:romaji mode
.k
.か
(ka).かk
.かき
(kaki).かきk
.かきく
(kakiku).かきくk
.かきくけ
(kakikuke).かきくけk
.かきくけこ
(kakikukeko).かきくけこ
(kakikukeko ).Another example, type "kakikukeko" in
hiragana mode
.kana mode
.か
(ka).かき
(kaki).かきく
(kakiku).かきくけ
(kakikuke).かきくけこ
(kakikukeko).かきくけこ
(kakikukeko ).And to convert to katakana or kanji is the same thing. You can toggle to
katakana mode
orkanji mode
and type on romaji or hiragana. And the computer will pop up an autocomplete window to you select your desired word.Method
Now, we will use software to type Japanese in a non-Japanese keyboard. My system when I create this text was:
Install
Ubuntu came with the IMF
IBus
(like a built in). But if you need to install IBus:Next, let's install our Japanese IME
MOZC
:Observation: look at the name of the package
ibus-mozc
. Its our IMF + IME names. So, in future we can search on APT repositories for IMF and Japanese IME alternatives, likeibus-*
, or*-mozc
.Installations completed!
Configurations
A Japanese keyboard has many different keys, to switch:
It is necessary to edit and memorize the Japanese input software's (binding) shortcut keys. Hiragana, katakana, kanji, romaji, upper/lower-case, full/half-width, Japanese symbols (period, quote, maru, tenten etc). So, you need to memorize/edit the keys to (des)activate the switches.
See the screenshots from before to get a hint of where the MOZC keymap is. To edit/read these keys on your Mozc:
IBus
(atGNOME Status Menu
) >Japanese (Mozc)
.IBus
(atGNOME Status Menu
) >Tools
>Properties
.Mozc Setting
window popped up, click on:General
tab >Keymap
section (at bottom) > Keymap Stylecustomize
button (first one).Mozc keymap editor
window popped up, click on: Scroll up and down to memorize and edit the Japanese keymap (bindings).From MOZC's source-code, see the table with all matches to the Japanese JIS special keys, as bellow:
You can consider to study/test other MOZC keys too, like:
So, we need to create new shortcuts similar with these, like bellow (these are my shortcut sugestions):
If you are interested, you can read MOZC's romaji-hiragana conversion table.
reset to defauts
button atMozc setting
window (opened in Step 3).If you edit these shortcuts, please consider conflicts with your existing shortcuts from:
With these key bindings you can type very well in a non-japanese keyboard. We didn't binding the others japanese keys to let you study the subject.
Alternative solutions
Similar softwares
Im using IBus to be my input method editor (IME). But you can switch to other IMF/IME if you desire. Others IMEs are:
sudo apt install ibus-anthy
.sudo apt install ibus-kkc
.sudo apt install ibus-skk
.The same as to input method framework (IMF), like:
sudo apt install fcitx
.sudo apt install fcitx-mozc
.sudo apt install fictx-kkc
.sudo apt install fictx-skk
.A list of IMF can be found List of input methods for Unix platforms and Linux input method framework brief summary.
Edit keymap file by a text editor
You can manage the keymap saving, editing, import/export and so on. To do that, read the file at source-code. If you wanna, you can download this file and edit it to be imported into your MOZC software.
So, to import/export the keymap file:
GNOME Status Menu
, select MOZC input method.GNOME Status Menu
, selectTools
>Properties
.Mozc Setting
window popped up, click on:General
tab >Keymap
section (at bottom) > Keymap Stylecustomize
button (first one).Mozc keymap editor
window popped up, click on:Edit
button menu (at bottom) > clickimport from file...
orexport from file...
. With that you can save (export) your keymap editions. And you can to insert a new keymap edited by importing it.That's all!
References
You may be interested in read this MOZC issue about how to switch between MOZC j-sylabaries. A good answer about MOZC inputs can be found here. A brief about MOZC input at askubuntu. A lot of questions commented about MOZC and input method. Answers to start MOZC in Hiragana mode.
It seems that on Windows with Google Japanese Input, the Hankaku/Zenkaku key gets automatically remapped to Alt+`. Either this doesn't happen on Ubuntu with mozc, or the Alt+` sequence is being intercepted somewhere (maybe by Unity for the switch-group command?).
In any case, all I needed to do was to go to System Settings > Text Entry > Japanese (mozc) > Settings > General > Keymap style → Customize... and rebind all instances of the Hankaku/Zenkaku key to some other key combination. I was working off of the MS-IME keymap as a base, so I only needed to change the "Activate IME" and "Deactivate IME" commands to something else.
It would have been nice if I could have used Alt+`, but that doesn't seem to be possible. Oh well.
I wasn't able to get it to work on ibus, but if you switch from ibus-mozc to fcitx-mozc input, you can use the ` key as the zenkaku (全角) toggle key to switch between romaji and hiragana input without going to the drop-down menu.
To switch to fcitx from ibus:
I'm using Ubuntu 16.04. If you click on the orange あ in the top corner you can go down to 'text entry' settings. Here it tells you how to switch between them by just using the keyboard. On my version it says Command + Space allows you to switch between English and Japanese without having to point and click. It works like a charm on mine.