Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting chinese keyboard layout fails #3

Closed
mviereck opened this issue Sep 28, 2020 · 8 comments
Closed

Setting chinese keyboard layout fails #3

mviereck opened this issue Sep 28, 2020 · 8 comments
Labels

Comments

@mviereck
Copy link
Owner

mviereck commented Sep 28, 2020

Attemps to change the keyboard layout to Chinese fail.
It defaults to US english keymap.

Setting the language locale with x11docker option --lang=zh_cn works.

Changing the keyboard layout with x11docker option --keymap=cn fails.
Changing the keyboard layout with deepin settings fails, too.
Found so far:

  • adding German keyboard layout in deepin settings works.
  • switching between German and English keyboard layout with keys super+space works.
  • adding Chinese keyboard layout in deepin settings works.
  • failure: switching to Chinese keyboard layout with keys super+space enables English keymap instead of Chinese.

In general it is possible to enable Chinese input with fcitx-pinyin, success here: mviereck/x11docker#269 (comment)

If someone has an idea how to fix this, I'd be happy to hear it.

@mviereck
Copy link
Owner Author

A workaround:

  • Install fcitx-pinyin in image
  • In deepin terminal run fcitx
  • Start fcitx configuration in deepin application menu
  • Add Chinese input method
  • Switch input methods with strg+space

@hongyi-zhao
Copy link

As far as the locale is concerned, I think en_US.UTF-8 is enough for all languages. See the following settings for my Ubuntu 20.04 box:

$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=

For the keyboard layout problem, I think the following packages should be installed first:

$ dpkg --get-selections | grep -i language-pack-zh
language-pack-zh-hans				install
language-pack-zh-hans-base			install
language-pack-zh-hant				install
language-pack-zh-hant-base			install

For the input method problem, I think the more robust and powerful chinese input methods are the following ones:

https://pinyin.sogou.com/linux/?r=pinyin
https://srf.baidu.com/site/guanwang_linux/index.html

After downloading the corresponding deb pakages, install them with the following methods.

  1. For baidupinyin
$ sudo apt-get install language-pack-zh-* language-pack-gnome-zh-* qt5-default qtcreator qml-module-qtquick-controls fcitx-bin fcitx-table fcitx-config-gtk fcitx-frontend-gtk3  fcitx-frontend-qt5

$ sudo gdebi fcitx-baidupinyin.deb
  1. For sogoupinyin

$ sudo gdebi sogoupinyin_2.3.2.07_amd64-831.deb

Then use the fcitx-config-gtk3 or fcitx-configtool command to select the desired input methods.

Based on my experience, the baidupinyin input method will not be listed if not install the sogoupinyin, so I just installed both of them side-by-side.

NB The above notes are my personal experiences on the Ubuntu 20.04 host box instead of a docker container environment. I give them here just for your infomation.

Regards,
HY

@mviereck
Copy link
Owner Author

The workaround seems not to work with recent apricot release. So there is no fix for this issue yet.

@mviereck
Copy link
Owner Author

Finally solved.
Beside installing the fcitx-sunpinyin package in image the missing key were some environment variables:

ENV XMODIFIERS=@im=fcitx QT4_IM_MODULE=fcitx QT_IM_MODULE=fcitx GTK_IM_MODULE=fcitx

fcitx is added to desktop autostart, so a user only needs to run the fcitx configuration from the app menu.

@hongyi-zhao
Copy link

hongyi-zhao commented Nov 26, 2020

ENV XMODIFIERS=@im=fcitx QT4_IM_MODULE=fcitx QT_IM_MODULE=fcitx GTK_IM_MODULE=fcitx

Are you sure it always relies on QT4 as the backend?

@mviereck
Copy link
Owner Author

Are you sure it always relies on QT4 as the backend?

It works the other way around: The environment variables tell QT and GTK to use fcitx.

@hongyi-zhao
Copy link

Are you sure it always relies on QT4 as the backend?

It works the other way around: The environment variables tell QT and GTK to use fcitx.

I'm still not so clear on your meaning. I mean if it depends on qt5, the variable set by you would be invalid.

@mviereck
Copy link
Owner Author

No, fcitx does not depend on QT or GTK.
GTK and QT get a message/the variables that they should use fcitx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants