Ubuntu installation Chinese zh_CN.UTF-8

How to install zh_CN.UTF-8 with Chinese support for Ubuntu system

how to in englishInstalling Chinese support in the system includes two steps: installing Chinese packages and configuring environment variables.

Installing Chinese support in the Ubuntu system is very simple and can be completed in just two steps:

The first step is to install the Chinese language pack:

sudo apt-get install language-pack-zh*

The second step is to configure relevant environment variables:

sudo vim /etc/environment

Add the following settings to the file:

LANG="zh_CN.UTF-8" LANGUAGE="zh_CN:zh:en_US:en" LC_ALL="LC_ALL=zh_CN.UTF-8"

The third step is to reset the local configuration:

sudo dpkg-reconfigure locales

Ubuntu系统安装中文 zh_CN.UTF-8-1

Ubuntu系统安装中文 zh_CN.UTF-8-1

If you do not need Chinese input method, the following steps can be omitted.

In addition, in order to ensure the normal use of the Chinese input method, you also need to install a Chinese input method engine, such as ibus-pinyin:

sudo apt-get install ibus-pinyin

After the installation is complete, ibus-pinyin can be enabled with the following command:

apt install ibus ibus-daemon -drx

Finally, select the input method as ibus-pinyin in the system settings.

Related commands:

locale --all-locales List all supported locales in the current system

localectl list-locales List all locales available on the current system

localectl set-locales LOCALE... Modifies the locale in the current system. It has the same function as locale and the same as exporting the three variables mentioned above.

At this point, you have successfully installed Chinese support in the Ubuntu system and can use the Chinese input method and display the Chinese interface normally.

The terminal displays Chinese normally, but the application displays Chinese abnormally.

The question this article addresses is """question","","", "cannot change locale ()","","","" and other problems, we provide a one-stop solution. If the system displays abnormal Chinese characters, such as garbled Chinese characters, etc., you can refer to this article

In order to achieve the purpose of displaying Chinese characters normally in the application, the following three variables should be as follows:

LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh:en_US:en LC_ALL=LC_ALL=zh_CN.UTF-8

But the problem is "LC_ALL to default locale: No such file or directory" and "LC_ALL: cannot change locale (zh_CN.UTF-8)", so reinstall the Chinese language pack.

Execute the following command

sudo apt-get -y install language-pack-zh-hans

or

sudo apt-get -y install language-pack-zh-hans language-pack-zh-hans-base

If you want to support traditional Chinese characters, execute

sudo apt-get -y install language-pack-zh-hant

or

sudo apt-get -y install language-pack-zh-hant language-pack-zh-hant-base

Then execute the locale command to set the current locale environment.

locale

5/5 - (1 vote)

Leave a Reply

Your email address will not be published. Required fields are marked *