mvf / qolibri

Continuation of the qolibri EPWING dictionary/book reader
GNU General Public License v2.0
172 stars 13 forks source link

Can't input Japanese #51

Closed Inqb8tr-jp closed 2 years ago

Inqb8tr-jp commented 2 years ago

Hi, Thank you for making qolibri. I can't input Japanese character on qolibri under Manjaro Linux. I use fcitx5-moz for Japanese input system. I installed qolibri with yay. qolibri's version: 2.1.4 Qt version: 5.15.5

When I encounterd input problem with Anki, installing fcitx-qt5 resolved the problem. But in this case, it doesn't work.

mvf commented 2 years ago

fcitx-qt5 is for Fcitx 4 and won't help here. I reckon it doesn't work in any Qt applications, not just qolibri.

I was curious about Manjaro anyway, so I spun up a Manjaro Plasma VM and did a yay -S qolibri.

The following fcitx packages are installed:

$ pacman -Qqe | grep fcitx
fcitx5-configtool
fcitx5-gtk
fcitx5-mozc
fcitx5-qt

IME settings look like this, I just added Mozc without touching any other settings:

fcitx5-manjaro

These environment variables are also needed:

$ cat ~/.xprofile
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS='@im=fcitx'

Voilà:

qolibri-manjaro

Inqb8tr-jp commented 2 years ago

Firstly sorry for wrong typed fcitx-qt5 instead of fcitx5-qt. I've installed fcitx5-qt already. And thank you for such a detailed explanation.

Now I can find the reason why I can't input Japanese. I evoke qolibri from a toolbar icon of my Manjaro Xfce. But the execution doesn't pass LC_CTYPE=ja_JP.UTF-8 to qolibri.

I made a bash script below as a workaround and designate it to the icon but failed somehow.

#!/usr/bin/bash 
LC_CTYPE=ja_JP.UTF-8 qolibri

By changing LC_CTYPE with LANG, qolibri's interface change into Japanese. So the script is fine. But the problem is not qolibri related probably.

Anyway when I evoke qolibri from terminal, I can input Japanese.

By the way, I've installed qolibri on my arm64 ChromeOS's debian container by building deb file too, and works fine. Thank you.

mvf commented 2 years ago

LC_CTYPE and LANG should not affect the IME. Your next finding suggests it's an envvar problem though:

Anyway when I evoke qolibri from terminal, I can input Japanese.

This sounds like the QT_IM_MODULE etc. envvars are set in your shell but not for the window manager. Maybe they're in your .bashrc or similar only? If you put them into ~/.xprofile or ~/.xinitrc and log out and back in, it should work. For further troubleshooting, you can print the environment of a running qolibri process like this:

$ strings /proc/$(pidof qolibri)/environ

This could help confirm if the variables are indeed missing when starting qolibri from the WM.

By the way, I've installed qolibri on my arm64 ChromeOS's debian container by building deb file too, and works fine.

Thanks, that's great to hear!

Inqb8tr-jp commented 2 years ago

Yes. I put environment variables into .bashrc. And after adding it to ~/.xprofile, qolibri accept Japanese input. Thank you so much and sorry for taking time for me.

mvf commented 2 years ago

No worries, I'd been meaning to check out Manjaro anyway. And I even found a bug (#52) in qolibri, so it's all good. Happy studying!