如何找出是什么弄乱了我的语言环境设置?

How to find out what messes up my locale-settings?

有些东西弄乱了我的语言环境设置,我无法找出发生这种情况的位置和原因。我在 Manjaro 系统上,但几天前安装了 Ubuntu 双启动选项。然后问题就开始了。

/etc/locale.gen

...
#en_BW ISO-8859-1  
#en_CA.UTF-8 UTF-8  
#en_CA ISO-8859-1  
en_DK.UTF-8 UTF-8  
#en_DK ISO-8859-1  
#en_GB.UTF-8 UTF-8 
...

调用了 sudo locale-gen

/etc/default/locale

LANG=en_DK.utf8
LC_CTYPE="en_DK.utf8"
LC_NUMERIC=en_DK.UTF-8
LC_TIME=en_DK.UTF-8
LC_COLLATE="en_DK.utf8"
LC_MONETARY=en_DK.UTF-8
LC_MESSAGES="en_DK.utf8"
LC_PAPER=en_DK.UTF-8
LC_NAME=en_DK.UTF-8
LC_ADDRESS=en_DK.UTF-8
LC_TELEPHONE=en_DK.UTF-8
LC_MEASUREMENT=en_DK.UTF-8
LC_IDENTIFICATION=en_DK.UTF-8
LC_ALL=

/etc/locale.conf

LANG=en_DK.UTF-8

manjaro-设置管理器:

everything set to en_DK.UTF-8

不再导出 bashrc、zshrc、~/.profile

输出语言环境:

locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_DK.UTF-8
LC_CTYPE="en_DK.UTF-8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_DK.UTF-8"
LC_MONETARY=en_GB.UTF-8
LC_MESSAGES="en_DK.UTF-8"
LC_PAPER=en_GB.UTF-8
LC_NAME=en_GB.UTF-8
LC_ADDRESS=en_GB.UTF-8
LC_TELEPHONE=en_GB.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_ALL=

使用

解决了这个问题
grep -rnw '.' -e 'en_GB.UTF-8'

发现 Ubuntu 在 ~/.pam_environment 中设置了区域设置,以某种方式覆盖了系统默认设置。更换后一切正常

也许这会为某人省去一些麻烦。