Difference between revisions of "Input method related environment variables"
Weng Xuetian (talk | contribs) m (→GTK_IM_MODULE) |
Weng Xuetian (talk | contribs) (Marked this version for translation) |
||
(14 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <languages /> | + | <languages/> |
− | |||
<translate> | <translate> | ||
− | |||
<!--T:1--> | <!--T:1--> | ||
− | This page | + | This page introduces the meaning of following environment variables. You don't need to understand it to use Fcitx, but it might help when you meet some problem, and let you examine what's going wrong. |
== XMODIFIERS == <!--T:2--> | == XMODIFIERS == <!--T:2--> | ||
This variable affects XIM only. The format is | This variable affects XIM only. The format is | ||
− | + | <!--T:3--> | |
XMODIFIERS=@im=<xim server name> | XMODIFIERS=@im=<xim server name> | ||
Line 15: | Line 13: | ||
When XIM server starts, it register a name, which will be used here. The name can not be same as other XIM server, so you cannot run two Fcitx under same X server. In general case, the XIM server name of Fcitx will be fcitx. | When XIM server starts, it register a name, which will be used here. The name can not be same as other XIM server, so you cannot run two Fcitx under same X server. In general case, the XIM server name of Fcitx will be fcitx. | ||
− | <!--T: | + | <!--T:5--> |
So the settings for Fcitx will be | So the settings for Fcitx will be | ||
− | + | <!--T:6--> | |
XMODIFIERS=@im=fcitx | XMODIFIERS=@im=fcitx | ||
− | + | <!--T:25--> | |
+ | In non-CJK locale, if this variable is not specified, XIM will not work for some application, which means you should always set it. And XIM will also need you to have correct locale, which means your locale is must in the output of | ||
+ | |||
+ | <!--T:26--> | ||
+ | locale -a | ||
+ | |||
+ | <!--T:27--> | ||
+ | You can check your locale by | ||
+ | |||
+ | <!--T:28--> | ||
+ | locale | ||
+ | |||
+ | <!--T:29--> | ||
+ | In order to use XIM, your locale also must NOT be C or POSIX. | ||
− | <!--T: | + | == GTK_IM_MODULE == <!--T:7--> |
+ | |||
+ | <!--T:8--> | ||
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. | 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. | ||
− | <!--T: | + | <!--T:9--> |
{{warning|After Debian goes multiarch, they will use different file. The file will be /usr/lib/<arch>/gtk-{2,3}.0/gtk.immodules }} | {{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 | You need to use | ||
− | + | <!--T:10--> | |
gtk-query-immodules-2.0 > <gtk-2.0 immodule file> | gtk-query-immodules-2.0 > <gtk-2.0 immodule file> | ||
− | <!--T: | + | <!--T:30--> |
− | + | to do update for gtk2. | |
+ | |||
+ | <!--T:32--> | ||
+ | Or if your gtk2 version is newer than 2.24.20, you should use | ||
+ | |||
+ | <!--T:33--> | ||
+ | gtk-query-immodules-2.0 --update-cache | ||
+ | |||
+ | <!--T:34--> | ||
+ | instead just like gtk3. | ||
+ | |||
+ | <!--T:11--> | ||
+ | and | ||
− | + | <!--T:12--> | |
gtk-query-immodules-3.0 --update-cache | gtk-query-immodules-3.0 --update-cache | ||
− | <!--T: | + | <!--T:31--> |
− | to update | + | to do update for gtk3. |
+ | |||
+ | <!--T:13--> | ||
+ | Otherwise new im module will not be recognized. | ||
− | <!--T: | + | <!--T:14--> |
If no im module specified by GTK_IM_MODULE is found, it will fallback to auto select method. | If no im module specified by GTK_IM_MODULE is found, it will fallback to auto select method. | ||
− | == QT_IM_MODULE == <!--T: | + | == QT_IM_MODULE == <!--T:15--> |
− | <!--T: | + | <!--T:16--> |
− | 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 qtconfig-qt4) can be used to configure the default one. | + | 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. |
− | <!--T: | + | <!--T:17--> |
Otherwise it will be override by QT_IM_MODULE. | Otherwise it will be override by QT_IM_MODULE. | ||
− | == LC_CTYPE == <!--T: | + | == LC_CTYPE == <!--T:18--> |
− | <!--T: | + | <!--T:19--> |
System locale should not be changed in all case. It might brings unpredictable effect. | System locale should not be changed in all case. It might brings unpredictable effect. | ||
− | <!--T: | + | <!--T:20--> |
− | This should only be used in | + | This should only be used in some case, including emacs and java. Emacs has a [http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-02/msg00761.html 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. |
+ | |||
+ | |||
− | <!--T: | + | <!--T:21--> |
− | + | For example, to only set this with emacs, run emacs with | |
− | + | <!--T:22--> | |
LC_CTYPE=zh_CN.UTF-8 emacs | LC_CTYPE=zh_CN.UTF-8 emacs | ||
− | <!--T: | + | <!--T:23--> |
It will not effect the display language of emacs. | It will not effect the display language of emacs. | ||
+ | |||
+ | <!--T:24--> | ||
+ | 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. | ||
</translate> | </translate> |
Latest revision as of 22:59, 2 February 2016
This page introduces the meaning of following environment variables. You don't need to understand it to use Fcitx, but it might help when you meet some problem, and let you examine what's going wrong.
XMODIFIERS
This variable affects XIM only. The format is
XMODIFIERS=@im=<xim server name>
When XIM server starts, it register a name, which will be used here. The name can not be same as other XIM server, so you cannot run two Fcitx under same X server. In general case, the XIM server name of Fcitx will be fcitx.
So the settings for Fcitx will be
XMODIFIERS=@im=fcitx
In non-CJK locale, if this variable is not specified, XIM will not work for some application, which means you should always set it. And XIM will also need you to have correct locale, which means your locale is must in the output of
locale -a
You can check your locale by
locale
In order to use XIM, your locale also must NOT be C or POSIX.
GTK_IM_MODULE
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.
and
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_IM_MODULE
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.
LC_CTYPE
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.