【WSL】Ubuntu 安装中文语言包并设为默认

换源

sudo sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
sudo sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
sudo rm /etc/apt/sources.list.d/google-chrome.list

安装语言包

# 安装中文基础语言包
sudo apt install language-pack-zh-hans
# 安装中文桌面语言包
sudo apt install language-pack-gnome-zh-hans
sudo apt install language-pack-kde-zh-hans
# 安装中文手册页(man命令)
sudo apt install manpages-zh

设置 locale

$ sudo vi /etc/locale.gen

找到 *zh_CN.UTF-8 UTF-8* 并取消注释,然后保存并退出

locale.gen...
# zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
# zh_HK BIG5-HKSCS
...

编译语言

$ sudo locale-gen
Generating locales (this might take a while)...en_US.UTF-8... donezh_CN.UTF-8... donezh_SG.UTF-8... done
Generation complete.

设置默认语言为中文

$ sudo vi /etc/default/locale

将内容修改为

localeLANG=zh_CN.UTF-8

最后

开启新的终端即可生效

$ sudo apt update
[sudo] gelomen 的密码:
命中:1 http://mirrors.aliyun.com/ubuntu focal InRelease
命中:2 http://mirrors.aliyun.com/ubuntu focal-security InRelease
命中:3 http://mirrors.aliyun.com/ubuntu focal-updates InRelease
命中:4 http://mirrors.aliyun.com/ubuntu focal-proposed InRelease
命中:5 http://mirrors.aliyun.com/ubuntu focal-backports InRelease
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
所有软件包均为最新。


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部