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

From Fcitx
Jump to navigation Jump to search
(Created page with "输入法相关环境变量")
 
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<languages/>
 
<languages/>
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.
+
这个页面介绍了以下环境变量的含义。你不需要理解他们来使用Fcitx,但是以下内容可能会在你遇到问题是帮助你检查哪里出了问题。
  
 
== XMODIFIERS ==
 
== XMODIFIERS ==
This variable affects XIM only. The format is
+
这个变量仅影响 XIM。格式为
  
  XMODIFIERS=@im=<xim server name>
+
  XMODIFIERS=@im=<xim 服务器名称>
  
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.
+
XIM 服务器启动时,他会注册一个应当在这里使用的名称。这个名称不能和其他 XIM 服务器相同,因此你无法在同一个 X 服务器下运行两个 Fcitx。通常情况下,Fcitx 的 XIM 服务器名称为 fcitx。
  
So the settings for Fcitx will be
+
因此对于 Fcitx 来说这个设置应当为
  
 
XMODIFIERS=@im=fcitx
 
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
+
在非 CJK 语言环境中,如果这个环境变量没有设置,一些程序中 XIM 将无法工作,这意味这你最好总是设置了这个环境变量。并且 XIM 也需要你有正确的语言环境,这意味着你的语言必须在下面的命令的输出当中
  
 
  locale -a
 
  locale -a
  
You can check your locale by
+
你可以通过以下命令检查你当前的语言环境
  
 
  locale
 
  locale
  
In order to use XIM, your locale also must NOT be C or POSIX.
+
为了使用 XIM,你的语言不能设置为 C 或者 POSIX。
  
 
== GTK_IM_MODULE ==
 
== 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.
+
这会覆盖系统的gtk输入法模块的自动选择。在默认情况下,gtk按照语言选择对应的输入法模块。Fcitx声明它支持 "zh:ja:ko:*"。这些信息将被记录在一个文件当中,在大多数的 linux 系统中,这个文件为 /etc/gtk-2.0/gtk.immodules /etc/gtk-3.0/gtk.immodules,有时会以 -32 或者 -64 结尾。
  
{{warning|After Debian goes multiarch, they will use different file. The file will be /usr/lib/<arch>/gtk-{2,3}.0/gtk.immodules }}
+
{{warning|Debian 进行了多架构的迁移之后,将使用不同的文件。对应文件将为 /usr/lib/<架构>/gtk-{2,3}.0/gtk.immodules }}
You need to use
+
你需要使用
  
  gtk-query-immodules-2.0 > <gtk-2.0 immodule file>
+
  gtk-query-immodules-2.0 > <gtk-2.0 的输入法模块文件>
  
to do update for gtk2.
+
更新 gtk2 的文件,
  
Or if your gtk2 version is newer than 2.24.20, you should use
+
或者如果你的 gtk2 版本新于 2.24.20,则应当使用
  
 
  gtk-query-immodules-2.0 --update-cache
 
  gtk-query-immodules-2.0 --update-cache
  
instead just like gtk3.
+
就像 gtk3 一样。
  
and
+
以及
  
 
  gtk-query-immodules-3.0 --update-cache
 
  gtk-query-immodules-3.0 --update-cache
  
to do update for gtk3.
+
更新 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.
+
如果由 GTK_IM_MODULE 指定的输入法模块没有被找到,gtk 将会回退到自动选择的方法。
  
 
== QT_IM_MODULE ==
 
== 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.
+
Qt 的输入法模块和 Gtk 类似,但是它不用额外的文件来识别。如果 QT_IM_MODULE 没有指定,qtconfig (Ubuntu/Debian/Archlinux 上是 qtconfig-qt4) 可以被用于选择默认的输入法模块。
  
Otherwise it will be override by QT_IM_MODULE.
+
否则它将会被 QT_IM_MODULE 选项覆盖。
  
 
== LC_CTYPE ==
 
== 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 [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.
+
这个环境变量应该仅在少数情况下被使用,包括 emacs 和 java。Emacs 有一个[http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-02/msg00761.html 历史悠久的Bug],在 en_US.UTF-8 或者其他类似的语系下,它不会使用 XIM (尽管emacs是gtk程序,但是它还是使用XIM)。唯一可以绕过这个问题的办法是通过设置 LC_CTYLE。
  
  
  
For example, to only set this with emacs, run emacs with
+
例如,为了只在 emacs 下修改这个环境变量,可以使用以下命令启动
  
 
  LC_CTYPE=zh_CN.UTF-8 emacs
 
  LC_CTYPE=zh_CN.UTF-8 emacs
  
It will not effect the display language of emacs.
+
它不会影响 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.
+
注意,由于 XIM 的一些限制,即使你不用中文,你也应该尝试把 LC_CTYPE 设置为 zh_CN.UTF-8。

Latest revision as of 04:03, 4 October 2017

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

这个页面介绍了以下环境变量的含义。你不需要理解他们来使用Fcitx,但是以下内容可能会在你遇到问题是帮助你检查哪里出了问题。

XMODIFIERS

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

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

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

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

XMODIFIERS=@im=fcitx

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

locale -a

你可以通过以下命令检查你当前的语言环境

locale

为了使用 XIM,你的语言不能设置为 C 或者 POSIX。

GTK_IM_MODULE

这会覆盖系统的gtk输入法模块的自动选择。在默认情况下,gtk按照语言选择对应的输入法模块。Fcitx声明它支持 "zh:ja:ko:*"。这些信息将被记录在一个文件当中,在大多数的 linux 系统中,这个文件为 /etc/gtk-2.0/gtk.immodules 和 /etc/gtk-3.0/gtk.immodules,有时会以 -32 或者 -64 结尾。

{{warning|在 Debian 进行了多架构的迁移之后,将使用不同的文件。对应文件将为 /usr/lib/<架构>/gtk-{2,3}.0/gtk.immodules }} 你需要使用

gtk-query-immodules-2.0 > <gtk-2.0 的输入法模块文件>

更新 gtk2 的文件,

或者如果你的 gtk2 版本新于 2.24.20,则应当使用

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

就像 gtk3 一样。

以及

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

更新 gtk3 的文件。

否则新的输入法模块将无法被识别。

如果由 GTK_IM_MODULE 指定的输入法模块没有被找到,gtk 将会回退到自动选择的方法。

QT_IM_MODULE

Qt 的输入法模块和 Gtk 类似,但是它不用额外的文件来识别。如果 QT_IM_MODULE 没有指定,qtconfig (Ubuntu/Debian/Archlinux 上是 qtconfig-qt4) 可以被用于选择默认的输入法模块。

否则它将会被 QT_IM_MODULE 选项覆盖。

LC_CTYPE

系统语系设置在任何情况下都不应该被修改。它可能会带来无法预测的效果。

这个环境变量应该仅在少数情况下被使用,包括 emacs 和 java。Emacs 有一个历史悠久的Bug,在 en_US.UTF-8 或者其他类似的语系下,它不会使用 XIM (尽管emacs是gtk程序,但是它还是使用XIM)。唯一可以绕过这个问题的办法是通过设置 LC_CTYLE。


例如,为了只在 emacs 下修改这个环境变量,可以使用以下命令启动

LC_CTYPE=zh_CN.UTF-8 emacs

它不会影响 emacs 的显示的语言。

注意,由于 XIM 的一些限制,即使你不用中文,你也应该尝试把 LC_CTYPE 设置为 zh_CN.UTF-8。