欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

Ubuntu修改系统语言为英文可支持中文

程序员文章站 2022-04-10 15:23:59
简单来说,就行修改/etc/default/locale文件,设置语言位UTF-8,如果没有这个语言,就执行命令locale-gen en_US.UTF-8进行安装,没有即时生效的话就重启。 ......

简单来说,就行修改/etc/default/locale文件,设置语言位UTF-8,如果没有这个语言,就执行命令locale-gen en_US.UTF-8进行安装,没有即时生效的话就重启。

查看当前系统语言

locale

修改系统语言

例如修改语言为英文

vi /etc/default/locale
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"

重启后,再次查看系统语言

locale

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

查看系统内安装的locale

locale -a 

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
POSIX
zh_CN.utf8
zh_SG.utf8

没装en_US.UTF-8

locale-gen en_US.UTF-8

再次查看

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