ubuntu 更改locale
2024-10-29 20:10:25服务器运维 主机评测网
如果有报如下错误 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 说明没有安装
查看当前系统语言环境
# localeLANG=en_US.UTF-8LC_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=
更改语言环境
现在需将en_US.UTF-8改为zh_US.UTF-8,en改为cn。编辑配置文件如下:
$ sudo vi /etc/default/localeLANG="zh_CN.UTF-8"LANGUAGE="zh_CN:zh"LC_ALL="zh_CN.UTF-8"
保存后执行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 说明没有安装
查看系统安装的locale
$ locale -a
安装locale
# locale-gen zh_CN.UTF-8
查看:
# localeLANG=zh_CN.UTF-8LANGUAGE=zh_CN:zhLC_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
赞一个! ()