fcitx / mozc

Mozc - a Japanese Input Method Editor designed for multi-platform
Other
117 stars 11 forks source link

Check for a Japanese keyboard layout in fcitx5-mozc #8

Closed hexclover closed 3 years ago

hexclover commented 3 years ago

It seems to me that Mozc in Kana mode always uses a char-to-kana mapping designed for the US keyboard layout, for example

` => ろ
[ => ゛

etc. This became problematic when I tried with a Japanese keyboard layout, where these mapping should be

\ => ろ
@ => ゛

and so on.

I followed the discussion https://github.com/google/mozc/issues/427 and found a correct mapping already present in src/unix/fcitx5/fcitx_key_translator.cc, and that this mapping is used in the series of translator functions as long as the arguments called layout_is_jp is set to true.

However, in src/unix/fcitx5/fcitx_key_translator.cc, which I believe all these layout_is_jp's originate from, I found that it is always specified as false:

  // TODO: check layout
  if (mozc_state->ProcessKeyEvent(event.rawKey().sym(), event.rawKey().code(),
                                  event.rawKey().states(), false,
                                  event.isRelease())) {
    event.filterAndAccept();
  }

So it seems to me that the detection of a JP keyboard layout hasn't been implemented for fcitx5-mozc.

Do you have time to implement this, or comment on how to implement it correctly? My understanding is to check the keyboard layout configured in the fcitx5 config tool (per group or per input method).

Thank you.

hexclover commented 3 years ago

Confirmed it works for me, thanks for your prompt response!