gpt4 book ai didi

linux - LC_MESSAGES 无效

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:29:45 25 4
gpt4 key购买 nike

设置 LC_MESSAGES 将消息(在我的例子中)从俄语更改为英语。

$ env | grep UTF
LC_MESSAGES=en_US.UTF-8
LANG=ru_UA.UTF-8

$ git status .
On branch master
Your branch is ahead of 'origin/master' by 11 commits.
(use "git push" to publish your local commits)

nothing to commit, working directory clean

一切似乎都正常,但正在通过 ssh 连接到该主机。尽管在变量 LC_MESSAGES 上,仍将消息发回俄罗斯。看:

$ ssh user@localhost
$ env | grep UTF
LC_MESSAGES=en_US.UTF-8
LANG=ru_UA.UTF-8
$ git status .
В ветке master
Your branch is ahead of 'origin/master' by 11 commits.
(use "git push" to publish your local commits)

нечего фиксировать, рабочая директория пуста

如何在俄罗斯保留界面但强制消息为英文?

$ uname -a Linux KES-PC 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

最佳答案

正如@thatotherguy 指出的,我必须使用 locale 来查看发生了什么。

第一种情况:

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

在 ssh 之后

$ssh user@localhost
$locale
LANG=ru_UA.UTF-8
LANGUAGE=ru_UA:ru
LC_CTYPE="ru_UA.UTF-8"
LC_NUMERIC="ru_UA.UTF-8"
LC_TIME="ru_UA.UTF-8"
LC_COLLATE="ru_UA.UTF-8"
LC_MONETARY="ru_UA.UTF-8"
LC_MESSAGES=en_US.UTF-8
LC_PAPER="ru_UA.UTF-8"
LC_NAME="ru_UA.UTF-8"
LC_ADDRESS="ru_UA.UTF-8"
LC_TELEPHONE="ru_UA.UTF-8"
LC_MEASUREMENT="ru_UA.UTF-8"
LC_IDENTIFICATION="ru_UA.UTF-8"
LC_ALL=

区别在于LANGUAGE。谷歌搜索帮助。该变量在 /etc/defaults/locale

中设置
$ cat /etc/default/locale
LANG="ru_UA.UTF-8"
LANGUAGE="ru_UA:ru"

所以我添加到我的.bashrc

export LANGUAGE=en

但是现在我不明白:

  1. 我在/etc/defautls/locale 中设置了 LANGUAGE。为什么在第一种情况下它的值为空字符串?
  2. 为什么 LANGUAGE 优先级不起作用?如果我设置 LANGUAGE=en:ruLANGUAGE=ru:en 我在这两种情况下都会收到俄语消息。

关于linux - LC_MESSAGES 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29287904/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com