第一步:编辑文件
代码:sudo gedit /var/lib/locales/supported.d/local
(这个文件是所有已经激活的区域语言的列表)
写入相关内容,比如写入如下内容:
zh_CN.UTF-8 UTF-8
zh_CN GB2312
zh_CN.GBK GBK
n_US.UTF-8 UTF-8
fr_FR ISO-8859-1
zh_CN.GB18030 GB18030
zh_CN.GBK GBK
n_US.UTF-8 UTF-8
fr_FR ISO-8859-1
zh_CN.GB18030 GB18030
第二步:生成相关的locales
代码:sudo locale-gen --purge
第三步:编辑文件
代码:sudo gedit /etc/default/locale
写入相关内容.比如,写入如下内容:
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
LC_ALL="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
LC_ALL="zh_CN.UTF-8"
第四步:重启电脑,终端中输入命令locale,看看命令是否报错,正常的结果如下:
代码:
~$ locale
LANG=zh_CN.UTF-8
LANGUAGE=zh_CN:en
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8
LANG=zh_CN.UTF-8
LANGUAGE=zh_CN:en
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8
转自:https://blog.****.net/justdoithai/article/details/52733226