Ubuntu安装中文语言包

中文语言包:

language-pack-zh-hans 简体中文

language-pack-zh-hans-base

language-pack-zh-hant 繁体中文

language-pack-zh-hant-base

安装中文语言包

sudo apt-get install  language-pack-zh-han*

运行语言支持检查

sudo apt install $(check-language-support)

修改配置文件:

vim /etc/default/locale

#将原始内容注释掉或删掉,替换为如下内容:
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
LC_NUMERIC="zh_CN"
LC_TIME="zh_CN"
LC_MONETARY="zh_CN"
LC_PAPER="zh_CN"
LC_NAME="zh_CN"
LC_ADDRESS="zh_CN"
LC_TELEPHONE="zh_CN"
LC_MEASUREMENT="zh_CN"
LC_IDENTIFICATION="zh_CN"
LC_ALL="zh_CN.UTF-8"

修改环境文件(环境变量(当前用户)):

vim /etc/environment

#在原内容下面追加下列内容:
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
LC_NUMERIC="zh_CN"
LC_TIME="zh_CN"
LC_MONETARY="zh_CN"
LC_PAPER="zh_CN"
LC_NAME="zh_CN"
LC_ADDRESS="zh_CN"
LC_TELEPHONE="zh_CN"
LC_MEASUREMENT="zh_CN"
LC_IDENTIFICATION="zh_CN"
LC_ALL="zh_CN.UTF-8"

修改环境文件(环境变量(所有用户)):

vim /etc/profile
#追加下列内容:
LANG="zh_CN.UTF-8"

重启

reboot

脚本

#!/bin/bash
apt-get install  language-pack-zh-han*
apt install $(check-language-support)
cat > /etc/default/locale <<EOF
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
LC_NUMERIC="zh_CN"
LC_TIME="zh_CN"
LC_MONETARY="zh_CN"
LC_PAPER="zh_CN"
LC_NAME="zh_CN"
LC_ADDRESS="zh_CN"
LC_TELEPHONE="zh_CN"
LC_MEASUREMENT="zh_CN"
LC_IDENTIFICATION="zh_CN"
LC_ALL="zh_CN.UTF-8"
EOF
cat >> /etc/environment <<EOF
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
LC_NUMERIC="zh_CN"
LC_TIME="zh_CN"
LC_MONETARY="zh_CN"
LC_PAPER="zh_CN"
LC_NAME="zh_CN"
LC_ADDRESS="zh_CN"
LC_TELEPHONE="zh_CN"
LC_MEASUREMENT="zh_CN"
LC_IDENTIFICATION="zh_CN"
LC_ALL="zh_CN.UTF-8"
EOF
cat >> /etc/profile <<EOF
LANG="zh_CN.UTF-8"
EOF
reboot

posted @ 2022-10-20 13:32  落笔画秋枫乀  阅读(86)  评论(0编辑  收藏  举报  来源