ubuntu如何在终端下更改系统语言

在前一篇文章中,我向大家解释了如何在图形界面下更改ubuntu的系统语言。现在,我介绍如何在终端下更改ubuntu的系统语言。将下面的命令复制粘贴运行,比图形界面的操作更加方便。

将语言更改为简体中文

首先安装简体中文语言包

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

然后安装firefox,libreoffice,thunderbird等程序的中文语言包

sudo apt-get install `check-language-support -l zh`

将locale中的语言设为zh_CN.UTF-8

sudo localectl set-locale LANG=zh_CN.UTF-8

最后重启系统

sudo reboot

重启系统后在终端中输入locale命令,你会看见,不仅是语言,其他所有的locale设置都变成了zh_CN
locale

将语言更改为繁体中文

如何你想要繁体中文语言包,那么输入下面的命令

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

zh-hans表示中华汉字简体,s代表simplified(简体)。zh-hant表示中华汉字繁体,t代表traditional(繁体)

然后安装firefox,libreoffice,thunderbird等程序的中文语言包

sudo apt-get install `check-language-support -l zh`

将locale的语言设为繁体,输入下面的命令

sudo localectl set-locale LANG=zh_HK.UTF-8

sudo localectl set-locale LANG=zh_TW.UTF-8

最后重启系统

sudo reboot

重启系统会在终端中输入locale命令,你会看见,不仅是语言,其他所有的locales设置都变成了zh_HK或者zh_TW

matrix@vivid:~$ locale
LANG=zh_HK.UTF-8
LANGUAGE=zh_HK
LC_CTYPE="zh_HK.UTF-8"
LC_NUMERIC="zh_HK.UTF-8"
LC_TIME="zh_HK.UTF-8"
LC_COLLATE="zh_HK.UTF-8"
LC_MONETARY="zh_HK.UTF-8"
LC_MESSAGES="zh_HK.UTF-8"
LC_PAPER="zh_HK.UTF-8"
LC_NAME="zh_HK.UTF-8"
LC_ADDRESS="zh_HK.UTF-8"
LC_TELEPHONE="zh_HK.UTF-8"
LC_MEASUREMENT="zh_HK.UTF-8"
LC_IDENTIFICATION="zh_HK.UTF-8"
LC_ALL=

安装另一种语言

如果你要安装日语,或者其他语言,方法与上述的类似。你可以输入下面的命令查看所有可安装的语言包

apt-cache search language-pack
为这篇文章评分
[Total: 12 Average: 3.7]

Leave a Reply

Your email address will not be published.

The maximum upload file size: 2 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here