我是法国人,用法语使用我的 Debian 系统。
但是,我想在终端中显示英文错误消息。它允许我将它们发布在英语网站上。
我怎样才能改变我的语言环境呢?我确切地说我不想让我的所有系统都用英语。
rus*_*ush 14
您必须在当前 shell 中更改LANG
和LANGUAGE
变量。
放
export LANG=en_US.UTF-8
export LANGUAGE=en
Run Code Online (Sandbox Code Playgroud)
在你的 shell rc 文件中(对于 bash 来说是~/.bashrc
)并重新启动终端会话(或者只是再次获取 rc 文件,source ~/.bashrc
甚至只是重新启动 bash exec bash
)
请注意,您必须先生成此语言环境。
你也可以使用export LANG=C
.
还有其他LANG
变量(来自man bash
):
LANG Used to determine the locale category for any category not
specifically selected with a variable starting with LC_.
LANGUAGE
Used to set messages languages (as LC_MESSAGES) to a
multi-valued value, e.g., setting it to fr:de:en will use French
messages where they exist; if not, it will use German messages,
and will fall back to English if neither German nor French
messages are available.
LC_ALL This variable overrides the value of LANG and any other LC_
variable specifying a locale category.
LC_COLLATE
This variable determines the collation order used when sorting
the results of pathname expansion, and determines the behavior
of range expressions, equivalence classes, and collating
sequences within pathname expansion and pattern matching.
LC_CTYPE
This variable determines the interpretation of characters and
the behavior of character classes within pathname expansion and
pattern matching.
LC_MESSAGES
This variable determines the locale used to translate double-
quoted strings preceded by a $.
LC_NUMERIC
This variable determines the locale category used for number
formatting.
Run Code Online (Sandbox Code Playgroud)
您可以使用以下语法调用应用程序:
例如,您需要英文联机帮助页(仅用于单个命令):
user@host:~# LC_ALL=C man ls
Run Code Online (Sandbox Code Playgroud)
或者您遇到错误(我的系统是德语):
user@host:~$ ls -la /root/
ls: Öffnen von Verzeichnis /root/ nicht möglich: Keine Berechtigung
user@host:~$ LC_ALL=C ls -l /root/
ls: cannot open directory /root/: Permission denied
Run Code Online (Sandbox Code Playgroud)
小智 -2
尝试引用此:1) https://wiki.debian.org/ChangeLanguage
简而言之,您需要设置您的 LOCALE(通过 LANG),最好是在 .bashrc 中。
export LANG=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)