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

I’m setting up Ubuntu to be able to input in three keyboard layouts:

  1. English (US)
  2. German
  3. Japanese (Mozc)(IBus)

What I’m finding is if I switch from English to Japanese directly, then romaji is input with a QWERTY keyboard, but if I switch to German first, and then to Japanese, the romaji is input with German’s QWERTZ keyboard.

In other words, mozc is just using whichever keyboard layout I had selected just before switching to it for entering romaji.

I’d like if I could fix it to one (preferably English US) regardless of which keyboard I was using last. If that means an alternative to mozc, I’m open to that too. In the meantime I can work around it as long as I remember to switch directly from English to Japanese.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

enter image description here

First click on this Mozc icon and bring

enter image description here

this window and click on the red arrow, preference button,

enter image description here

Pull-down the menu from Input Method Default to your favorite.

Solution 2

If it is desired to keep IBus instead of switching to fcitx, the file /usr/share/ibus/component/mozc.xml can be edited as a temporary workaround:

Change <layout>default</layout> to <layout>us</layout> and restart IBus.

Solution 3

TLDR

Solution 1

Change the layout from ibus-mozc.xml file.

Solution 2

Edit/import the romaji-hiragana keymap from ibus-mozc to your keyboard layout.

How to do (solution 2)

To do that:

  1. Click on Gnome Status menu (Gnome’s top-left bar) > IBus menu (i.e. keyboard/input language selector) > Select Japanese Mozc input method.
  2. Again, click on Gnome Status Menu > IBuz > tools > Properties > Mozc Settings window.
  3. From Keymap section > click on customize button (second one, from Romaji table).
  4. Create new entries with your specific keys to binding the romaji-hiragana keys.
  5. If messed things up, click on reset to defaults button from Mozc Settings window.

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

Explanation

IBUS

Every time I switch the language (e.g: english, spanish, etc) from IBUS, the keyboard layout changes.
So the keys are remapped.
But this is an IBUS comportment.
And some users reported this issue before.

MOZC

Specifically for MOZC, it doesn’t change the keyboard layout.
Because Japanese (romaji) can be inserted/typed/represented by any language (phonetically).

And the most common usage is to use only one foreign language keyboard layout.
So MOZC switch by your_foreign_language to japanese.
It is an one-to-one relation, by default.

Alternative solutions

Install another Japanese IMEs

Just install and use another Input Method Engines (IMEs).
MOZC is just one IME (a Japanese IME).
Japanese IMEs from IBUS are: MOZC, anthy, SKK, KKC.

To install these IBUS Japanese IMEs:

  • MOZC: sudo apt install ibus-mozc.
  • Anthy: sudo apt install ibus-anthy.
  • KKC: sudo apt install ibus-kkc.
  • SKK: sudo apt install ibus-skk.

After install all of them, you can select the desired one by: Click on Gnome Status menu (Gnome’s top-left bar) > IBus menu (i.e. keyboard/input language selector) > Select your desired (japanese) IME.
You can see at the first screenshot all of them installed (see the green highlight) and showed by IBUS to be selected.

Install another IMFs

You can install a alternative for IBUS.
IBUS is a type of Input Method Framework (IMF).
It manages different kind of IMEs.

One suggestion is to install FCITX:

  • Fcitx: sudo apt install fcitx.
    • and you need to install the IMEs for FCITX, like:
      • sudo apt install fcitx-mozc.
      • sudo apt install fictx-kkc.
      • sudo apt install fictx-skk.
  • Ibus: sudo apt install ibus

A list of IMF can be found in List of input methods for Unix platforms and Linux input method framework brief summary.

I think with that information you can manage what can work for your local setup.

Solution 4

2021 Solution: User Config

Recent versions of ibus store the layout in the user configuration directory, which is preferable to modifying the installation config as root.

  1. Edit ibus_config.textproto in your user configuration directory, i.e. one of:
  • $XDG_CONFIG_HOME/mozc/ibus_config.textproto
  • $HOME/.config/mozc/ibus_config.textproto
  • $HOME/.mozc/ibus_config.textproto
  1. Change the layout key to us, i.e.

    engines {
      name : "mozc-jp"
      longname : "Mozc"
      layout : "default"   <-- change "default" to "us"
    }
    
  2. Run ibus write-cache; ibus restart to apply changes.

Credits:

  • Thanks ibus team for the super helpful comments inside of /usr/share/ibus/component/mozc.xml.
  • Thanks Daniel T for his previous answer.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply