Ubuntu – Japanese (Mozc) Wrong Keyboard Layout

fcitxibusjapanesekeyboard-layoutmozc

I just upgraded from Ubuntu 16.04 to 18.04 because of the Japanese (Mozc) Keyboard Layout problem and it persists in 18.04. Here is the problem described:

When using mozc to input Japanese, it's using the last selected keyboard layout to input romaji – can I fix which one it uses?

Below the answer is a comment that says I should install fcitx to get the "Configure Current Input Method" option. For that person it seems to have worked. But not for me.

In "Language Support" (Settings > Region & Language > Manage Installed Languages), I see under "Keyboard input method system" the following options: fcitx, IBus, XIM, none. Whichever option I choose I don't get the "Configure Current Input Method" option. And therefore I can't set the keyboard layout for Japanese (Mozc).

What am I doing wrong? I need to write Japanese and German, but writing Japanese and having a German keyboard layout pushed on me is really inconvenient.

My mozc.xml looks like this:

<component>
    <version>2.20.2673.102+dfsg-2</version>
    <name>com.google.IBus.Mozc</name>
    <license>New BSD</license>
    <exec>/usr/lib/ibus-mozc/ibus-engine-mozc --ibus</exec>
    <textdomain>ibus-mozc</textdomain>
    <author>Google Inc.</author>
    <homepage>https://github.com/google/mozc</homepage>
    <description>Mozc Component</description>
<engines>
<engine>
    <description>Mozc (Japanese Input Method)</description>
    <language>ja</language>
    <symbol>&#x3042;</symbol>
    <rank>80</rank>
    <icon_prop_key>InputMode</icon_prop_key>
    <icon>/usr/share/ibus-mozc/product_icon.png</icon>
    <setup>/usr/lib/mozc/mozc_tool --mode=config_dialog</setup>
    <layout>default</layout>
    <name>mozc-jp</name>
    <longname>Mozc</longname>
</engine>

How should it look like at the end? Do the first two lines mean, I should make a backup copy? What do the @@ lines mean? And remove default and add jp? I'm trying to edit the file with gedit. Thank you very much for your help?

Best Answer

I think that David provided a useful hint. ibus-mozc does not seem to provide a GUI for controlling the keyboard layout used together with Mozc, but you can edit the file /usr/share/ibus/component/mozc.xml:

--- /usr/share/ibus/component/mozc.xml.orig
+++ /usr/share/ibus/component/mozc.xml
@@ -16,7 +16,7 @@
   <icon_prop_key>InputMode</icon_prop_key>
   <icon>/usr/share/ibus-mozc/product_icon.png</icon>
   <setup>/usr/lib/mozc/mozc_tool --mode=config_dialog</setup>
-  <layout>default</layout>
+  <layout>jp</layout>
   <name>mozc-jp</name>
   <longname>Mozc</longname>
 </engine>

Or in plain English:

Replace the line

  <layout>default</layout>

with

  <layout>jp</layout>

With that change (and after a relogin), Japanese (Mozc) will always be based on the basic Japanese keyboard layout, irrespective of which keyboard layout you switched from when enabling Japanese (Mozc). Hence you can add e.g. the German layout without it affecting your use of Japanese (Mozc).

HTH