0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Linux: 使用できる言語について調べたい

Posted at

たまたま調べる機会があったので、ついでにメモ。

実施環境:
Linux
[root@testhost ~]# uname -a
Linux testhost 4.18.0-331.el8.x86_64 #1 SMP Thu Aug 19 16:49:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[root@testhost ~]# echo $SHELL
/bin/bash

日本語表示が必須なソフトウェア等を入れる時に、「このサーバは何の言語が使用できるんだっけ?」と調べたい時があります。
そのような時は、 locale コマンドを使用します。

Linux
[root@testhost ~]# locale -a
C
C.utf8
en_AG
---------- ( 省略 ) ----------
en_ZW.utf8
ja_JP.eucjp
ja_JP.utf8
POSIX

上記の場合は、英語(en)と日本語(ja)が使用できるとわかります。
では、上記で出てこない言語を使用したい場合はどうすればよいでしょうか。

新しい言語を追加したい場合は、 glibc-langpack-* パッケージをインストールします。
利用できるパッケージの一覧は、 dnf list で確認できます。

Linux
[root@testhost ~]# dnf list | grep "glibc-langpack-"
glibc-langpack-en.x86_64                               2.28-162.el8                                  @baseos
glibc-langpack-ja.x86_64                               2.28-162.el8                                  @baseos
glibc-langpack-aa.x86_64                               2.28-162.el8                                  baseos
---------- ( 省略 ) ----------
glibc-langpack-yuw.x86_64                              2.28-162.el8                                  baseos
glibc-langpack-zh.x86_64                               2.28-162.el8                                  baseos
glibc-langpack-zu.x86_64                               2.28-162.el8                                  baseos

では、試しにドイツ語(de)をインストールしてみます。

Linux
[root@testhost ~]# dnf -y install glibc-langpack-de
Last metadata expiration check: 20:26:21 ago on Wed 25 Aug 2021 01:12:08 AM EDT.
Dependencies resolved.
---------- ( 省略 ) ----------

Complete!
[root@testhost ~]# locale -a
C
C.utf8
de_AT
---------- ( 省略 ) ----------
en_ZW.utf8
ja_JP.eucjp
ja_JP.utf8
POSIX
[root@testhost ~]# echo $LANG
en_US.UTF-8
[root@testhost ~]# date
Wed Aug 25 21:40:21 EDT 2021
[root@testhost ~]# LANG=de_AT
[root@testhost ~]# date
Mi Aug 25 21:40:57 EDT 2021

これで、ドイツ語が使用できるようになりました。

※ Mi = Mittwoch (ドイツ語で水曜日)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?