[LINUX] Ubuntu 19.10 Eoan Ermine Japanese / Japanese locale environment and time zone settings

Overview

Install language pack suitable for Japanese / Japanese locale environment, locale setting, time zone setting, installation of Japanese language compatible package, etc. on Ubuntu 19.10 Eoan Ermine

Installation of Japanese language pack

Install the language-pack-ja-base and language-pack-ja packages.

If language-pack-ja is specified, language-pack-ja-base will also be installed as a dependency.

$ sudo apt install language-pack-ja language-pack-ja-base

Ubuntu – eoan language \ -pack \ -ja package details Ubuntu – eoan language \ -pack \ -ja \ -base Package details

Japan / Japanese locale setting

It is as follows in the state where it is set to American English.

/ etc / default / locale is a file that describes the system-wide default locale.

$ cat /etc/default/locale 
#  File generated by update-locale
LANG="en_US"
LANGUAGE="en_US:"

Environment variable.

$ env | grep LANG
LANGUAGE=en_US:
LANG=en_US

Locale information by the locale command.

$ locale
LANG=en_US
LANGUAGE=en_US:
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=

You can set the system default locale to Japan / Japanese by specifying LANG = ja_JP.UTF-8 with the update-locale command. LANGUAGE is automatically disabled.

$ sudo update-locale LANG=ja_JP.UTF-8
*** update-locale: Warning: LANGUAGE ("en_US:") is not compatible with LANG (ja_JP.UTF-8). Disabling it.

The / etc / default / locale file is updated.

$ cat /etc/default/locale
#  File generated by update-locale
LANG=ja_JP.UTF-8
#LANGUAGE="en_US:"

Log out of the current shell and log back in to apply the current default locale to the shell.

(In this case, source / etc / default / locale also updates LANG and LANGUAGE remains undeleted, so it's best to log in again, but it's unclear if the value of LANGUAGE can be an issue.)

You can see that the environment variable LANG has been updated and LANGUAGE has been removed.

$ env | grep LANG
LANG=ja_JP.UTF-8

If you look at the locale information from the locale command, ja_JP.UTF-8 is set. LANGUAGE is unspecified.

$ locale
LANG=ja_JP.UTF-8
LANGUAGE=
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_PAPER="ja_JP.UTF-8"
LC_NAME="ja_JP.UTF-8"
LC_ADDRESS="ja_JP.UTF-8"
LC_TELEPHONE="ja_JP.UTF-8"
LC_MEASUREMENT="ja_JP.UTF-8"
LC_IDENTIFICATION="ja_JP.UTF-8"
LC_ALL=

Ubuntu Manpage: locale - get locale-specific information Ubuntu Manpage: update-locale - Modify global locale settings

Set the time zone to Japan time

You can check the time zone with the timedatectl command.

$ timedatectl
               Local time:Sat 2020-01-11 06:58:50 UTC
           Universal time:Sat 2020-01-11 06:58:50 UTC
                 RTC time:Sat 2020-01-11 06:58:51
                Time zone: UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

You can check the list of timezones that can be set with timedatectl list-timezones.

$ timedatectl list-timezones | grep Tokyo
Asia/Tokyo

You can set the timezone with timedatectl set-timezone. Here, Asia / Tokyo, which is the time zone of Japan time, is set.

$ sudo timedatectl set-timezone Asia/Tokyo

If you check the time zone with timedatectl, it is Japan time.

$ timedatectl
               Local time:Sat 2020-01-11 15:59:18 JST
           Universal time:Sat 2020-01-11 06:59:18 UTC
                 RTC time:Sat 2020-01-11 06:59:19
                Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Ubuntu Manpage: timedatectl - Control the system time and date

Installation of Japanese language support package

You can get a list of packages that are missing in the environment of the language specified by the check-language-support command.

$ check-language-support -l ja
fcitx fcitx-frontend-gtk2 fcitx-frontend-gtk3 fcitx-frontend-qt4 fcitx-frontend-qt5 fcitx-mozc fcitx-ui-classic fonts-noto-cjk fonts-noto-cjk-extra language-pack-ja mozc-utils-gui

If you try the following command, it seems that the Japanese-compatible package of the unused package will be installed.

$ sudo apt install $(check-language-support -l ja) -s

(The -s option of apt install doesn't actually change the installation of the package, it allows you to simulate what happens when you install it)

It may be better to select and install only the packages you need.

Ubuntu Manpage: check-language-support - returns the list of missing packages in order to provide a

Reference material

-Japaneseize WSL Ubuntu environment: Tech TIPS -@IT -Linux 101 exam preparation: localization and internationalization -Locale management by environment variables \ (1/2 ) -ITmedia Enterprise

Recommended Posts

Ubuntu 19.10 Eoan Ermine Japanese / Japanese locale environment and time zone settings
GCP Ubuntu 14.04 and above: Japanese localization of system language and time zone
Packet filtering settings using iptables on Ubuntu 19.10 Eoan Ermine and their persistence
ubuntu 20.04 + Geth environment account settings and ether mining
Install Apache 2.4 on Ubuntu 19.10 Eoan Ermine and run CGI
Modify Ubuntu tofu to Japanese environment
Japanese settings for matplotlib and Seaborn axes
Build Python3 and OpenCV environment on Ubuntu 18.04
Python virtual environment and packages on Ubuntu