Note: The author used Ubuntu 20.4 version for testing#
1. Check if the Chinese language pack is installed#
locale -a
If zh_CN.utf8 is available, skip to the second step#
If not, please execute the following command#
sudo apt-get install language-pack-zh-hans -y # Install the Chinese language pack
locale-gen zh_CN.UTF-8 # Add support
2. Modify the configuration file#
The configuration file is located at /etc/default/locale, so use vim to modify it#
vim /etc/default/locale
Then modify the content to the following#
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_IDENTIFICATION="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_ALL=zh_CN.UTF-8
3. Restart#
reboot
Article link: https://z-r.cc/2021/08/20/ubuntu%E6%9B%B4%E6%8D%A2%E7%BB%88%E7%AB%AF%E8%AF%AD%E8%A8%80%E4%B8%BA%E4%B8%AD%E6%96%87.html