Difference between revisions of "Input method related environment variables/zh-hans"

From Fcitx
Jump to navigation Jump to search
(Created page with "在非 CJK 语言环境中,如果这个环境变量没有设置,一些程序中 XIM 将无法工作,这意味这你最好总是设置了这个环境变量。并且 XIM...")
(Created page with "你可以通过以下命令检查你当前的语言环境")
Line 17: Line 17:
  locale -a
  locale -a
You can check your locale by

Revision as of 23:26, 2 February 2016

Other languages:
English • ‎中文(简体)‎



这个变量仅影响 XIM。格式为

XMODIFIERS=@im=<xim 服务器名称>

当 XIM 服务器启动时,他会注册一个应当在这里使用的名称。这个名称不能和其他 XIM 服务器相同,因此你无法在同一个 X 服务器下运行两个 Fcitx。通常情况下,Fcitx 的 XIM 服务器名称为 fcitx。

因此对于 Fcitx 来说这个设置应当为


在非 CJK 语言环境中,如果这个环境变量没有设置,一些程序中 XIM 将无法工作,这意味这你最好总是设置了这个环境变量。并且 XIM 也需要你有正确的语言环境,这意味着你的语言必须在下面的命令的输出当中

locale -a



In order to use XIM, your locale also must NOT be C or POSIX.


This will override the system automatic gtk im module selection. By default gtk select im module by the language provided by im module. Fcitx declares that it support "zh:ja:ko:*". And this information will be record in a file, on most linux system it's /etc/gtk-2.0/gtk.immodules and /etc/gtk-3.0/gtk.immodules, or suffixed with -32 or -64.

{{warning|After Debian goes multiarch, they will use different file. The file will be /usr/lib/<arch>/gtk-{2,3}.0/gtk.immodules }} You need to use

gtk-query-immodules-2.0 > <gtk-2.0 immodule file>

to do update for gtk2.

Or if your gtk2 version is newer than 2.24.20, you should use

gtk-query-immodules-2.0 --update-cache

instead just like gtk3.


gtk-query-immodules-3.0 --update-cache

to do update for gtk3.

Otherwise new im module will not be recognized.

If no im module specified by GTK_IM_MODULE is found, it will fallback to auto select method.


Qt's im module is similar with Gtk, but don't need extra file to recognize. If QT_IM_MODULE is not specified, qtconfig (Ubuntu/Debian/ArchLinux qtconfig-qt4) can be used to configure the default one.

Otherwise it will be override by QT_IM_MODULE.


System locale should not be changed in all case. It might brings unpredictable effect.

This should only be used in some case, including emacs and java. Emacs has a historical bug, that under en_US.UTF-8 or similar locale, it will never use XIM (Though emacs is a gtk app, it use XIM). The only way to walkaround this is to use LC_CTYPE to fix this.

For example, to only set this with emacs, run emacs with

LC_CTYPE=zh_CN.UTF-8 emacs

It will not effect the display language of emacs.

Notice, even if you are not using Chinese, you should also try to set it so LC_CTYPE=zh_CN.UTF-8, due to some limitation of XIM.