ubuntu adds Chinese support for implementation methods

  • 2020-05-15 03:22:37
  • OfStack

1. Install Chinese language package & Chinese input method in ubuntu

The default ubuntu installation has only the English language, so it cannot display Chinese characters. To display Chinese characters correctly, you need to install the Chinese language pack. Click on the left icon bar to open the System Settings (system Settings) menu, and click on the Language Support (language support) TAB. You can see that all the installed languages begin with English, so the system only supports English display.

To support other languages, click Install/Remove Languages, drop down from the popup TAB to Chinese(Simplified), or simplified Chinese, and tick the box below. Then click Apply Changes to submit, and the system will automatically download the Chinese language package online. If prompted for a missing installation package, enter: sudo apt-get update on the command line. (make sure ubuntu is connected to the Internet)

Note: if the Chinese language package is updated, the cat display is still garbled. You can try to solve it by:

First, restart the virtual machine ubuntu.

Second, verify the encoding of your text file in Windows. After the language pack is installed, generally 1 can only display the Chinese text encoded in UTF-8 format, while the Chinese text encoded in ANSI format is still scrambled (in SourceInsight software, it is ANSI code). You can use software such as notepad++ to convert ANSI text into UTF-8. You can also solve the problem of ubuntu displaying the Chinese scrambled ANSI encoding through section 3 below.

2. Change the system display language

The ubuntu we installed is an English version of the system. The system menu and other displays are all in English by default. Do not like English interface, hope to use Chinese version. What to do? In fact, after installing the Chinese language package, we can change the system display language to Chinese. Once again, in the System Settings (system Settings) Language Support (language support) TAB, scroll down in the top list of installed languages (English (United States), and you can see "Chinese (China)" in the last bit (this is the Chinese language pack we installed above).

In ubuntu14.04, the system display language is determined in the order in which the installed language packages appear in the list. Since the current bit 1 is "English", the default display is in English. If we want to display in Chinese by default, we should set "Chinese (China)" to bit 1. The setting method is drag, mouse click "Chinese (China)", when the background color changes (to indicate the selected), hold down the left mouse button, drag up to the first place.

It will not take effect immediately after setting. It will only take effect after the next login. At this point, you can shut down the virtual machine (enter init 0 or other shutdown command from the command line), restart it, and you will see the Chinese interface.

3. ubuntu displays the resolution of Chinese scrambled codes in ANSI encoding format

After the Chinese language support package above is installed, add the Chinese character encoding:


$sudo vim /var/lib/locales/supported.d/local

Add the following Chinese character set:


zh_CN.GBK GBK
zh_CN.GB2312 GB2312
zh_CN.GB18030 GB18030

Make it effective:


$sudo dpkg-reconfigure locales

For vim, you need to modify the configuration file to display Chinese:

Open the vim configuration file at /etc/vim/vimrc

Add:


set fileencodings=utf-8,gb2312,gbk,gb18030
set termencoding=utf-8
set encoding=prc

Save to exit, then:


source /etc/vim/vimrc

At this point, vim will display Chinese correctly.

4. Chinese input method installation and mutual switching

When installing the Chinese language package, the ibus-pinyin input method has been installed by default, which supports both Chinese and English input (you can switch between Chinese and English with Shift, and you can customize the switching mode). It is said that Googlepinyin under linux is good.

Thank you for reading, I hope to help you, thank you for your support of this site!


Related articles: